Created
August 5, 2024 16:03
-
-
Save hughdbrown/04a715b8c11157348eb683f9e630cffd to your computer and use it in GitHub Desktop.
Common python logging preamble
This file contains 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 | |
FORMAT = '%(asctime)s %(message)s' | |
logging.basicConfig( | |
format=FORMAT, | |
datefmt="%Y-%m-%dT%H:%M:%S", | |
# logger levels are: DEBUG, INFO, WARNING, ERROR, CRITICAL | |
level=os.environ.get('LOGLEVEL', 'INFO').upper(), | |
) | |
logger = logging.getLogger() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment