Le lundi 26 décembre 2016 10:34:48 UTC-5, Alec Taylor a écrit :
> So I'm putting .info in one StringIO and .error in another StringIO.
> 
> How do I stop them from both being put into both?
> 
> Code: http://ideone.com/Nj6Asz


Hi,

it's doable with filter on the handlers:


def exact_filter(level):
    def filter(record):
        return level == record.levelno
    filter.filter = filter
    return filter

stdout_stream.addFilter(exact_filter(logging.INFO))
stderr_stream.addFilter(exact_filter(logging.ERROR))
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to