proemergotech/prmrgt-monolog-formatter

用于从日志上下文中提取自定义键值对的Monolog格式化器。默认使用RFC3339/ISO8601日期时间格式,包含微秒。

1.0.0 2017-10-11 15:32 UTC

This package is not auto-updated.

Last update: 2024-09-15 04:31:25 UTC


README

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

安装

  • 通过Composer安装
composer require proemergotech/prmrgt-monolog-formatter

使用

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.md文件。

致谢

此包由Miklós BorosPro Emergotech Ltd.开发。

许可

该项目在MIT许可证下发布。