Last active
February 28, 2025 10:14
-
-
Save juanpabloaj/3e6a41f683c1767c17824811db01165b to your computer and use it in GitHub Desktop.
python logging, log level with environment variable
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 os | |
import logging | |
LOGLEVEL = os.environ.get('LOGLEVEL', 'INFO').upper() | |
logging.basicConfig(level=LOGLEVEL, format="%(asctime)s %(message)s") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I like the usage of environment variables with default values. Very useful!