How to best write extension with its own logger that end user can set level? #4863
Replies: 3 comments
-
as far as i know - many extensions have "hardcoded" loglevel. So you must edit extensions code. |
Beta Was this translation helpful? Give feedback.
-
I'd just silence the app logger altogether and use logging directly. Also, if you have a question/problem related to a specific extension, it'd be good to mention its name (or even link to its repo) |
Beta Was this translation helpful? Give feedback.
-
If an extension is using the app logger in a way you don't think it should, you should report that issue to the extension. You don't need to edit the extension or silence the entire logger. Python's logging has a filter mechanism: https://docs.python.org/3/library/logging.html#filter-objects. Attach a |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I am using an extension that uses the app logger and is polluting my screen with logs I don't want. I want to make a pull request or fork this project with logging I can control and I'm not seeing any docs on this topic. Specifically, I've been looking at Flask docs which I haven't seen mention this topic and I've browsed a few popular extensions and noticed they don't have logging at all.
Any guide on best practice to set up logging in a flask extension so the end user can set the level of the extension's logs?
Beta Was this translation helpful? Give feedback.
All reactions