Nice idea... in principle.

But, what if my program has several loggers with several handlers each having 
its own logging info level? Would the Python's interpreter CLI argument (or the 
ENV variable) override all loggers and handlers logging levels? Why should CLI 
/ ENV override those loggers and handlers?

Ok... I know that the above-mentioned logging configuration is probably seldom 
used in real world... But logging module allows that kind of uses. For 
instance, in my case, I used to create a (root) logger with two handlers: a 
stream to stdout and log file. the stdout stream has a higher logging level 
(say, critical) than the log file (say, info) -- so most log records go to file 
while worst messages are also display in terminal.

Additionally... if the logging level is changed by the program at some point, I 
think that the CLI / ENV logging level will become useless. Talking about me 
again, I used to create a logger with logging.getLogger and change immediately 
its logging level to the desired level with logger.setLevel. So, in my case, 
the CLI / ENV level would be overridden even before any log message was issued. 
Of course, most developers probably do not do that but... it can be done. Or 
not?

Or are you suggesting a different approach? Are you suggesting that CLI / ENV 
would create an ex novo basicConfig logger (beyond program's loggers and 
handlers) and that all program's log messages would be sent to that CLI / ENV 
logger instead of (or also to) program's loggers?

Thank you.
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/DAUVSZ56SRDWHDZGBDCP5CCE2IYBL2UX/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to