Reputation: 51
I am using structlog library to log for my Python project. I see some third party library logs which I do not want. How do I remove those logs?
Upvotes: 1
Views: 706
Reputation: 51
I solved this by adding the following in my logging setup:
logging.config.dictConfig({
'disable_existing_loggers': True, # this disables the existing loggers from logging anything.
...
})
Upvotes: 0
Reputation: 74655
Logging has a number of locations where you can filter messages. Via the log level of the specific module as in logging.getLogger(...).setLevel(...)
or via a filter attached to a logger or attached to a handler.
Upvotes: 2