gazelle_logger 0.1.2 copy "gazelle_logger: ^0.1.2" to clipboard
gazelle_logger: ^0.1.2 copied to clipboard

Provides logging functionality for Gazelle applications, allowing developers to log incoming requests and outgoing responses.

Gazelle Logger Plugin #

The Gazelle Logger Plugin provides logging functionality for Gazelle applications. It allows developers to log incoming requests and outgoing responses, making it easier to debug and monitor application behavior.

Based on logger.

Installation #

To use the Gazelle Logger Plugin, add gazelle_logger as a dependency in your pubspec.yaml file:

dependencies:
  gazelle_core: <latest-version>
  gazelle_logger: <latest-version>

Then, run dart pub get to install the package.

Usage #

Import the package in your Dart file:

import 'package:gazelle_logger/gazelle_logger.dart';

Initialize the plugin and register it with your Gazelle application:

void main() async {
  final app = GazelleApp();
  await app.registerPlugin(GazelleLoggerPlugin());

  // Define your routes here

  await app.start();
}

Now, you can use the provided hooks to log requests and responses:

app.get(
  "/",
  (request, response) async => response.copyWith(
    statusCode: 200,
    body: "Hello, Gazelle!",
  ),
  preRequestHooks: [app.getPlugin<GazelleLoggerPlugin>().logRequestHook],
  postResponseHooks: [app.getPlugin<GazelleLoggerPlugin>().logResponseHook],
);

The logRequestHook logs incoming requests, while the logResponseHook logs outgoing responses.

1
likes
140
pub points
14%
popularity

Publisher

verified publisherintales.it

Provides logging functionality for Gazelle applications, allowing developers to log incoming requests and outgoing responses.

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (LICENSE)

Dependencies

gazelle_core, logger

More

Packages that depend on gazelle_logger