Wish: Allow all log Handlers to accept the level argument

Fayaz Yusuf Khan fayaz.yusuf.khan at gmail.com
Thu May 17 06:07:10 EDT 2012


***TRIVIAL ISSUE***, but this has been irking me for a while now.
The main logging.Handler class' __init__ accepts a level argument while none 
of its children do. The poor minions seem to be stuck with the setLevel 
method which considerably lengthens the code.

In short:
Let's do this:
root.addHandler(FileHandler('debug.log', level=DEBUG)
Instead of this:
debug_file_handler = FileHandler('debug.log')
debug_file_handler.setLevel(DEBUG)
root.addHandler(debug_file_handler)

Python 2.7
--
Cloud architect, Dexetra SS, Kochi, India
fayaz.yusuf.khan_AT_gmail_DOT_com, fayaz_AT_dexetra_DOT_com
+91-9746-830-823





More information about the Python-list mailing list