Skip to content

Instantly share code, notes, and snippets.

@Ed1123
Last active September 2, 2022 23:00
Show Gist options
  • Save Ed1123/9300efe987cfe1a19d9cc3dd73baf5b7 to your computer and use it in GitHub Desktop.
Save Ed1123/9300efe987cfe1a19d9cc3dd73baf5b7 to your computer and use it in GitHub Desktop.
Get Python logging level from environment variable
# From https://powerfulpython.com/blog/nifty-python-logging-trick/
import logging
import os
LOGLEVEL = os.environ.get('LOGLEVEL', 'WARNING').upper()
logging.basicConfig(level=LOGLEVEL)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment