Package Data | |
---|---|
Maintainer Username: | aldogint |
Maintainer Contact: | aldoutamaginting@gmail.com (aldoginting) |
Package Create Date: | 2017-09-27 |
Package Last Update: | 2018-08-13 |
Home Page: | |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2024-12-23 03:11:31 |
Package Statistics | |
---|---|
Total Downloads: | 1,158 |
Monthly Downloads: | 0 |
Daily Downloads: | 0 |
Total Stars: | 1 |
Total Watchers: | 1 |
Total Forks: | 1 |
Total Open Issues: | 2 |
Enable Papertrail Logging on Laravel/Lumen.
composer require aldoginting/papertrail-laravel *
If you're using lumen >= 5.6.x, skip this step.
Configure Monolog in bootstrap/app.php:
$app->configureMonologUsing(function ($monolog) {
$papertrailHandler = new \PapertrailLaravel\Handler\PapertrailLogHandler({YOUR_PAPERTRAIL_HOST}, {YOUR_PAPERTRAIL_PORT}, {APP_NAME(optional)});
$formatter = new \Monolog\Formatter\LineFormatter('%level_name% REQUEST: %message%');
$papertrailHandler->setFormatter($formatter);
$monolog->pushHandler($papertrailHandler);
return $monolog;
});
Add following line to your config/logging.php
channels:
'papertrail' => [
'driver' => 'monolog',
'handler' => \PapertrailLaravel\Handler\PapertrailLogHandler::class,
'handler_with' => [
'host' => 'your_papertrail_host',
'port' => 'your_papertrail_port',
],
'formatter' => Monolog\Formatter\LineFormatter::class,
'formatter_with' => [
'format' => '%level_name% REQUEST: %message%',
],
],
protected $middleware = [
...
PapertrailLaravel\Middleware\PapertrailLoggingMiddleware::class,
];
$app->middleware([
...
PapertrailLaravel\Middleware\PapertrailLoggingMiddleware::class,
]);
You can log response by adding PAPERTRAIL_LOG_RESPOSE=true
in your .env