nbah1990 / laravel-logger-extension
Package contains additional log drivers and notification channels
v1.0.7
2020-11-13 06:49 UTC
Requires
- php: ^7.2|^7.4
- fluent/logger: ^1.0
- guzzlehttp/guzzle: ^6.0|^7.0
- illuminate/contracts: ~5.8.0|^6.0|^7.0|^8.0
- illuminate/support: ~5.8.0|^6.0|^7.0|^8.0
- monolog/monolog: ^1.12|^2.0
- psr/log: ^1.0
Requires (Dev)
- roave/security-advisories: dev-master
README
Package contains:
- laravel/lumen + monolog -> fluentd integration;
- guzzle requests log middleware;
To install the package use:
composer require nbah1990/laravel-logger-extension
How to use fluentd integration:
- Add to the
logging.php
config a new channel:
'fluentd' => [ 'driver' => 'monolog', 'handler' => \LaravelLoggerExtension\Monolog\Handler\FluentdHandler::class, 'level' => 'debug', 'handler_with' => [ 'host' => env('FLUENTD_HOST'), 'port' => env('FLUENTD_PORT') ], ]
How to use guzzle/http log integration:
- Create or publish the config
laravel-logger-extension.php
(you can find default config herevendor/nbah1990/laravel-logger-extension/src/LaravelLoggerExtension/config/laravel-logger-extension.php
. By default, it looks like:
return [ // pass true to enable log of all guzzle requests 'guzzle_log_integration_enabled' => false, // guzzle client config with additions for logger 'guzzle_log_integration' => [ // you can add other guzzle client settings here // you can set your own handler for guzzle client // 'handler' => new \GuzzleHttp\HandlerStack(), // pass channels that should be used to write logs, they should be defined in the 'logging.php' configuration 'log_channels' => [ ], // format of the log message 'log_formatter' => new \GuzzleHttp\MessageFormatter( '{method}({code}) - {uri} - {req_body} - {res_body} - {req_headers} - {error}' ), //by default all responses will be wrote with this level 'log_default_level' => Psr\Log\LogLevel::DEBUG ] ];