Created
July 16, 2023 08:11
-
-
Save lyrick17/9103db10c2e36fda93c7657eb4ee33fc to your computer and use it in GitHub Desktop.
Revisions
-
lyrick17 created this gist
Jul 16, 2023 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,14 @@ # This is set up code for logging in Python # - the format can be changed import logging logging.basicConfig(level=logging.DEBUG, format='%(asctime)s - %(levelname)s - %(message)s') # this is the set up instead if you want to save the logs in another file logging.basicConfig(filename="filename.txt", level=logging.DEBUG, format='%(asctime)s - %(levelname)s - %(message)s') # Disable all the logs...(will be used to stop the logs) # - you can change CRITICAL into DEBUG, WARNING, INFO, ERROR, CRITICAL # depending on log level you want to disable # - where CRITICAL is highest log level logging.disable(logging.CRITICAL) # Comment this code if you don't want the logs to appear