mirror of
https://github.com/Seldaek/monolog.git
synced 2026-04-26 08:05:53 +03:00
[GH-ISSUE #1069] Filter out some log messages based on runtime config? #434
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#434
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 @howardjones on GitHub (Oct 29, 2017).
Original GitHub issue: https://github.com/Seldaek/monolog/issues/1069
In my app, I use error codes on warnings, and allow users to mute certain warnings (e.g. "--no-warn WARN22"). I plan to use monolog (1.23 for now, until I stop supporting php 5.6) and use the context data to tag the warning with the error code if it has one.
But, how can I implement the muting/filtering behaviour in monolog? They'll all be the same log level. Can a processor return null or an empty event, to indicate that the event shouldn't be logged? Internally I already have a list of currently-muted error codes to check against.
@howardjones commented on GitHub (Jan 2, 2018):
Answering my own issue - you can't return null, but you can set the level to something non-existent...
@Seldaek commented on GitHub (Jun 8, 2018):
You could also use a wrapping handler instead of a processor, to filter what gets passed down to the other handlers. That'd be the more "monolog" way to do this.