python - Getting events of all levels using a non-root logger -
I have a non-root logger with some handlers, and I want the logger to have every event with them, - At the defined levels - I have a This, however, those events that I do not want should be unconditional to my handler. I am thinking that if Here's a minimal example - it does not print anything, which I do not want: log .set level (notice) .
logs .Set level (1) would be the right choice, it does not seem elegant, so perhaps there is another way to accomplish that?
Log = Mill Logger ("MyLoger") handler = Streamhandler (standout) logs. Adhendler (handler) logs. Set level (notice) logs. Debug ("some") log.setLevel (logging. DEBUG) without any other consideration. In this case, you want to cover every potential user-defined level, which can be achieved using the level 1. I do not think this is unbearable, this is the only difference between this and
log.setLevel (logging.ADUU). Is there no underlying stability for the level you're using? If it makes you feel better, you can define the constants to clarify from Map 1 that what you are doing :
import getLogger, log with StreamHandler sys import stdout ALL_LEVELS = 1 log = getLogger ("Mylogger") handler = streamhandler (stdout) log.addHandler (handler) log.setLevel (ALL_LEVELS ) Log.debug ("some")
Comments
Post a Comment