Skip to content

proemergotech/prmrgt-monolog-formatter

Repository files navigation

prmrgt-monolog-formatter

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.

About

Custom Monolog formatter for extracting custom key-values from log context. Uses RFC3339/ISO8601 datetime with microseconds by default.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages