Skip to content

Instantly share code, notes, and snippets.

@bswrundquist
Created October 31, 2019 02:04
Show Gist options
  • Save bswrundquist/ace34a8fd8871b3c2d0adcc27f875c01 to your computer and use it in GitHub Desktop.
Save bswrundquist/ace34a8fd8871b3c2d0adcc27f875c01 to your computer and use it in GitHub Desktop.
Simple logging to use inside a module.
import logging
import sys
def global_logger(name):
logging.basicConfig(
stream=sys.stdout,
level=logging.INFO,
format="%(asctime)s - %(levelname)s - %(name)s - %(funcName)s - %(message)s",
)
return logging.getLogger(name)
log = global_logger(__name__)
log.info('Log INFO to stdout')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment