Skip to content

Instantly share code, notes, and snippets.

@ishikawa
Created August 1, 2008 09:18
Show Gist options
  • Select an option

  • Save ishikawa/3600 to your computer and use it in GitHub Desktop.

Select an option

Save ishikawa/3600 to your computer and use it in GitHub Desktop.
Python Logger Configuration
import logging
def _configureLogger():
"""Returns configured default logger for module."""
handler = logging.StreamHandler(sys.stderr)
handler.setFormatter(logging.Formatter(LOGGER_FORMAT))
logger = logging.getLogger('org.metareal.XmlPropertyListParser')
logger.setLevel(LOGGER_LEVEL)
logger.addHandler(handler)
return logger
# A logger for xml parsing stuff.
LOGGER_LEVEL = logging.INFO
LOGGER_FORMAT = "%(asctime)s [%(levelname)s] %(message)s (in %(funcName)s:%(lineno)d)"
LOGGER = _configureLogger()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment