Logging to file and not to console

Peter Otten __peter__ at web.de
Sun Oct 27 07:18:28 EDT 2013


Peter Otten wrote:

> def levelnames():
>     try:
>         names = logging._nameToLevel
>     except AttributeError:
>         names = (name for name in logging._levelNames if isinstance(name,
> str))

Trainwreck alert :(

I recommend that you use the following list

"DEBUG INFO WARN ERROR CRITICAL".split()

directly rather than fixing the above.





More information about the Python-list mailing list