Created
October 31, 2019 02:04
-
-
Save bswrundquist/ace34a8fd8871b3c2d0adcc27f875c01 to your computer and use it in GitHub Desktop.
Simple logging to use inside a module.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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