-
Notifications
You must be signed in to change notification settings - Fork 32
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
Is there a way of selectively disabling request_starter / request_finished / task_started / task_succeeded / task_enqueued? #283
Comments
Python has a log filtering mechanism. Have you considered it? |
I've never used it but i will give it a try, thanks |
# filters implementations
def event_blacklist(blacklist):
# this filter remove the events included in the provided blacklist
b = set(blacklist)
def func(record):
return record.msg["event"] not in b
return func
LOGGING = {
"version": 1,
"disable_existing_loggers": False,
"filters": { # <- declaration of filters
"event_blacklist": {
"()" : "config.settings.my_filters.event_blacklist",
"blacklist": ["request_finished"] # <- list of events to blacklist
}
},
"formatters": {
# ....
"handlers": {
"colored_stream": {
"class": "logging.StreamHandler",
"formatter": "colored",
"filters": ["event_blacklist"], # <- filters to use for this handler
}, Source: https://docs.python.org/3/howto/logging-cookbook.html#custom-handling-of-levels Do whatever you want with the filter. |
This is what I ended up doing yesterday
|
I was not sure you found a solution since you left the issue opened. 👍 |
During development, the request_starter / request_finished / task_started / task_succeeded / task_enqueued logs start to clutter the command line.
Is there a way to selectively disable some of these logs?
For example:
The text was updated successfully, but these errors were encountered: