Skip to content

Instantly share code, notes, and snippets.

@erynofwales
Created December 2, 2011 18:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save erynofwales/1424249 to your computer and use it in GitHub Desktop.
Save erynofwales/1424249 to your computer and use it in GitHub Desktop.
Quick setup of the root logger for Python's logging module
loghandler = logging.StreamHandler(sys.stdout)
loghandler.setFormatter(logging.Formatter(
fmt='%(asctime)s:%(name)s:%(levelname)s: %(message)s',
datefmt='%Y-%m-%d %H:%M:%S'))
rootlog = logging.getLogger()
rootlog.addHandler(loghandler)
rootlog.setLevel(logging.DEBUG)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment