[Python-ideas] add a LogReader to the logging module

terji78 at gmail.com terji78 at gmail.com
Wed May 10 12:55:21 EDT 2017



Hi! Isn't it just basicConfig? 
>
>     import logging 
>     logging.basicConfig( 
>         filename='test.log', 
>         format='[%(asctime)s] %(name)s %(levelname)s: %(message)s', 
>         level=logging.DEBUG, 
>     ) 
>     log = logging.getLogger("TEST") 
>   


BasicConfig does not allow different settings for different log readers, as 
I can see. E.g.

    import logging 
    logging.basicConfig( 
        level=logging.DEBUG, 
    ) 
    log1 = logging.getLogger("TEST1") 
 
    logging.basicConfig( 
       level=logging.INFO,
    )
    log2 = logging.getLogger("TEST2")

Here log2 will write out logs at the same level as log1, so basicConfic is 
IMO too basic for a lot of use cases and so you'll have to go through the 
other more verbose setup. 

So, this getLogReader function would be more general than basicConfig, but 
also much more useful. (But please educate me, if I've misunderstood 
basicConfig)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20170510/f438ffc1/attachment.html>


More information about the Python-ideas mailing list