Skip to content

Instantly share code, notes, and snippets.

@hughdbrown
Created August 5, 2024 16:03
Show Gist options
  • Save hughdbrown/04a715b8c11157348eb683f9e630cffd to your computer and use it in GitHub Desktop.
Save hughdbrown/04a715b8c11157348eb683f9e630cffd to your computer and use it in GitHub Desktop.
Common python logging preamble
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