datenkraft / monolog-formatter
Datenkraft Monolog JSON Formatter
Installs: 3 935
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Requires
- php: ^8.2
- monolog/monolog: ^3.3
Requires (Dev)
- phpunit/phpunit: ^9.6.9
- squizlabs/php_codesniffer: ^3.7.2
README
This library can re-format json log. The single line formatter is based on the Datenkraft\MonologGkeFormatter\GkeFormatter and is optimized for the Google Kubernetes Engine, whereas the multi line formatter is for local logging with beautified output.
Both introduced formatter convert objects which would not be convertible by monolog to arrays. Please be aware that through this feature private data could be exposed to log if not adding it to the blacklist.
Installation
composer require Datenkraft/monolog-formatter
Usage
use Monolog\Logger; use Monolog\Handler\StreamHandler; use Datenkraft\MonologFormatter; $handler = new StreamHandler('php://stdout'); $handler->setFormatter(new SingleLineFormatter()); // or $handler->setFormatter(new MultiLineFormatter());