Skip to content

gbenson.net

Tag: snippet

Python hacking

Python‘s had this handy logging module since July 2003. A lot of things use it, so if you’re trying to understand or debug some Python code then a handy snippet to insert somewhere is:

import logging
logging.basicConfig(level=1)

Those two lines cause all loggers to log everything to the console. Check out the logging.basicConfig docs to see what else you could do.

gbenson HOWTOs, Python, Snippets Leave a comment Friday 11th October 2019Friday 11th October 2019 1 Minute
Proudly powered by WordPress | Theme: Independent Publisher 2 by Raam Dev.