m6web/monolog-extra-bundle

为Monolog提供额外功能

安装量: 297,275

依赖项: 0

建议者: 0

安全: 0

星标: 7

关注者: 51

分支: 2

开放问题: 1

类型:symfony-bundle

v5.0.0 2022-09-27 12:48 UTC

This package is auto-updated.

Last update: 2024-08-27 17:25:57 UTC


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