Skip to content

Instantly share code, notes, and snippets.

@amykyta
Created May 5, 2017 18:15
Show Gist options
  • Save amykyta/b8b7c5188bc8237db0b37f107ecc17dd to your computer and use it in GitHub Desktop.
Save amykyta/b8b7c5188bc8237db0b37f107ecc17dd to your computer and use it in GitHub Desktop.
Logger for stdout
import logging
import sys
logger = logging.getLogger()
logger.setLevel(logging.DEBUG)
ch = logging.StreamHandler(sys.stdout)
ch.setLevel(logging.DEBUG)
formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
ch.setFormatter(formatter)
logger.addHandler(ch)
logger.warn("Blah Blah blah")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment