-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DI: handlers are global #2
Comments
Interesting solution. But I would preffer having structured configuration of a single extension. Like in Kdyby/Doctrine. monolog:
errors:
name: errors
handlers: ...
sql:
registerFallback: no
hookToTracy: no
handlers: ... but then, the problem with tags remains... I think one tag should remain, but when it has a metadata (tags can have additional meta) then register only to the monolog named as the metadata of the handler tag services:
- {class: ..., tags: [monolog.handler]} # this will be registered to all Logger instances
- {class: ..., tags: [monolog.handler: errors]} # only to instance named "errors"
- {class: ..., tags: [monolog.handler: sql]} # only to instance named "sql" |
Is there any workaround to do that? will be solved? i agree with @mkoubik |
There is currently no workaround I'm aware of. I'm working a bit with symfony now, so I intent to copy their style of configuring monolog, since this lib has very weak support for complex channel+handler setups. |
Minor fixes & increase code coverage for PR to Kdyby/Monolog for Nette v 3.0
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 multipleMonologExtension
s like this:The problem is that handlers from
monolog.sql
have "global" tagmonolog.handler
somonolog.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)?
The text was updated successfully, but these errors were encountered: