Skip to content

Instantly share code, notes, and snippets.

@kylelambert101
Created August 18, 2020 17:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kylelambert101/5340d2e67210e106c1a0dd76ac4f476e to your computer and use it in GitHub Desktop.
Save kylelambert101/5340d2e67210e106c1a0dd76ac4f476e to your computer and use it in GitHub Desktop.
Python -> Logging
'''
Use this to set up basic configuration for application logging.
Call this at the top in one file, then any following functions (even
in other files) can send log statements via the typical logging
functions (logging.info, logging.error, etc)
'''
# Set up logging
logging.basicConfig(
level=logging.DEBUG,
filename="api.log",
filemode='a',
format='%(asctime)s - (%(levelname)s) - %(message)s',
datefmt='%Y-%m-%d %H:%M:%S')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment