Skip to content

DI: handlers are global #2

@mkoubik

Description

@mkoubik

TLDR: Is there any support for multiple channels in a single extension?

I want to log SQL queries separately besides logging exceptions (ideally to have another instance of Monolog\Logger) so I tried to register multiple MonologExtensions like this:

extensions:
    monolog.errors: Kdyby\Monolog\DI\MonologExtension
    monolog.sql: Kdyby\Monolog\DI\MonologExtension

monolog.errors:
    name: errors

monolog.sql:
    name: sql
    registerFallback: no
    hookToTracy: no
    handlers:
        ...

The problem is that handlers from monolog.sql have "global" tag monolog.handler so monolog.errors uses them as well. Instead I would like the tag prefixed (monolog.sql.handler) so you can register the extension multiple times.
Is this a valid solution, should I send PR (it's a BC break)?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions