Created
August 18, 2020 17:35
-
-
Save kylelambert101/5340d2e67210e106c1a0dd76ac4f476e to your computer and use it in GitHub Desktop.
Python -> Logging
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
''' | |
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