shippeo/monolog-extra

An extension to Monolog that adds handlers, formatters and processors. Includes integrations for Symfony.

v0.3 2023-10-10 15:56 UTC

This package is auto-updated.

Last update: 2024-04-10 17:08:08 UTC


README

An extension to Monolog that adds handlers, formatters and processors. Includes integrations for Symfony.

Cookbook symfony

Processor

ApplicationName

Declaration of service config/services.yaml with tag monolog.processor

    Shippeo\Monolog\Processor\ApplicationNameProcessor:
        arguments:
            - '%env(APP_NAME)%'
        tags:
            - { name: 'monolog.processor' }

Formatter

Gelf

Declaration of handler in config/monolog.yaml

monolog:
    handlers:
        graylog:
            type:   gelf
            level:  info
            publisher: {hostname: '%env(GRAYLOG_HOST)%', port: '%env(GRAYLOG_PORT)%', chunk_size: 0}
            formatter: App\Log\GelfMessageFormatter

Declaration of service in config/services.yaml

    Shippeo\Monolog\Formatter:
        - '%env(GRAYLOG_TOKEN)%'