m6web / monolog-extra-bundle
为Monolog提供额外功能
v5.0.0
2022-09-27 12:48 UTC
Requires
- php: >=8.1
- monolog/monolog: ^3.0
- symfony/expression-language: ~5.0 || ~6.0
- symfony/framework-bundle: ~5.0 || ~6.0
- symfony/monolog-bundle: ~3.0
Requires (Dev)
- atoum/atoum: ~3.4 || ~4.0
- symfony/yaml: ~5.0 || ~6.0
README
为Monolog提供额外功能。
此扩展包实际版本支持 Symfony >= 4.4
。如果您需要支持旧版本,您必须使用 < 3.0
版本。
安装
通过composer
"require": { "m6web/monolog-extra-bundle":"1.1.*" }
然后在内核中启用该扩展包
<?php $bundles = [ new M6Web\Bundle\MonologExtraBundle\M6WebMonologExtraBundle ];
配置
处理器
处理器可以添加、修改或删除日志内容。
目前,只有一个处理器可用:ContextInformationProcessor
。它允许您为每个日志条目添加额外的上下文信息。
m6_web_monolog_extra: processors: myProcessor: # Given that there is only one processor for now, # type is optionnal and will have ContextInformation as default value type: ContextInformation # You can attach the processor to a handler or a channel, but not both # Those two configuration entry are optionnal, if you omit both # then the processor will be attached to all log channel and handlers. handler: gelf channel: request # Then you can define the context information you wish to add # Each entry under config will be an entry in context information config: foo: bar bar: foo env: expr(container.getParameter('kernel.environment'))
测试
$ ./vendor/bin/atoum