proemergotech / prmrgt-monolog-formatter
Custom Monolog formatter for extracting custom key-values from log context. Uses RFC3339/ISO8601 datetime with microseconds by default.
Installs: 3 328
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 7
Forks: 0
Open Issues: 0
Requires
- php: >=7.1.0
- monolog/monolog: ^1.23
Requires (Dev)
- fzaninotto/faker: ~1.6
- phpunit/phpunit: ^6.4
- squizlabs/php_codesniffer: ^3.1
This package is not auto-updated.
Last update: 2024-12-22 05:50:11 UTC
README
A custom Monolog formatter for extracting custom key-values from log context. Uses RFC3339/ISO8601 datetime with microseconds by default.
Installation
- Install via Composer
composer require proemergotech/prmrgt-monolog-formatter
Usage
This formatter can be added to a Monolog handler as any other formatter. Each logging handler uses a Formatter to format the record before logging it.
$handler = new Monolog\Handler\StreamHandler(env('LOG_STREAM', '/tmp/stdout.sock'), \Monolog\Logger::DEBUG); $handler->setFormatter(new PrmrgtLogFormatter(['keyToExtract', 'otherKeyToExract], 'Y-m-d H:i:s')); $monolog->pushHandler($handler);
You can find more information on handlers, formatters and processors in the official Monolog documentation.
Contributing
See CONTRIBUTING.md file.
Credits
This package is developed by Miklós Boros at Pro Emergotech Ltd..
License
This project is released under the MIT License.