mirror of
https://github.com/Seldaek/monolog.git
synced 2026-04-26 16:15:49 +03:00
[GH-ISSUE #256] Use CubeHandler with other handlers #87
Labels
No labels
Bug
Documentation
Feature
Needs Work
Support
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/monolog#87
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @sagikazarmark on GitHub (Oct 26, 2013).
Original GitHub issue: https://github.com/Seldaek/monolog/issues/256
This is probably not an issue, but a real use case which causes a problem for me.
I am writting a queue management package, and I am using PSR3 compatible logging. I would like to make it work with Cube server, so I was very happy when I realized that monolog supports it. Probably everyone will use monolog as the logger, but the chance is given to use own written loggers.
Now I am passing a Logger object to the worker and this logs failures, succes messages, etc.
I started to implement logging a Cube compatible message (type, job payload, etc), but I stopped, because I realized, that this way the Cube server also gets all other log messages, which is wrong.
I could log everything over debug level and preserve the debug level for cube messages but that is ugly. :-)
My ideas: pass a second logger interface to worker which contains only a cube handler or solve connection to cube server without logger.
I don't like any of above, so I am asking you. Do you have any ideas how it could be solved by using PSR3 logger, which generally means monolog?
Thanks in advance
@Seldaek commented on GitHub (Oct 28, 2013):
One thing could be to have a special handler wrapping the existing handler(s) that would filter out log records that are|are not cube messages. That way you could send everything to one logger and sort of route records to the right handler. It's not something that is possible with monolog natively though, you would have to write your own handler or extend the Logger to support such use case.