Skip to content

Instantly share code, notes, and snippets.

@webee
Created May 28, 2014 03:27
Show Gist options
  • Select an option

  • Save webee/caf9c826600f1da1bb12 to your computer and use it in GitHub Desktop.

Select an option

Save webee/caf9c826600f1da1bb12 to your computer and use it in GitHub Desktop.
python logging demo.
import logging
def get_logger():
level = logging.DEBUG
formatter = logging.Formatter('%(asctime)s - %(levelname)s - %(module)s[%(lineno)d] - %(funcName)s - %(message)s')
logger = logging.getLogger(__name__)
logger.setLevel(level)
ch = logging.StreamHandler()
ch.setLevel(level)
ch.setFormatter(formatter)
logger.addHandler(ch)
return logger
logger = get_logger()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment