Skip to content

Instantly share code, notes, and snippets.

@bmacauley
Created March 28, 2013 13:37
Show Gist options
  • Save bmacauley/5263175 to your computer and use it in GitHub Desktop.
Save bmacauley/5263175 to your computer and use it in GitHub Desktop.
logging
import logging
logger = logging.getLogger('myapp')
hdlr = logging.FileHandler('/var/tmp/myapp.log')
formatter = logging.Formatter('%(asctime)s %(levelname)s %(message)s')
hdlr.setFormatter(formatter)
logger.addHandler(hdlr)
logger.setLevel(logging.WARNING)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment