Created
July 21, 2020 18:17
-
-
Save sfdc-afraley/0780e431de04aeeb78541909c417dffb to your computer and use it in GitHub Desktop.
Revisions
-
sfdc-afraley created this gist
Jul 21, 2020 .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,32 @@ """ Example using the Python logger """ import logging def main(): """ MAIN """ init_logger(debug=True) logging.info('Hey this message is important and is always outputted') some_var = 123545 logging.debug('This is only important when debugging') logging.debug('Here is the value of some variable: %s', some_var) logging.error('SOMETHING WENT WRONG ALERT ALL THE THINGS!') def init_logger(debug=False): """ Start the python logger """ log_format = '%(asctime)s %(levelname)-8s %(message)s' if debug: level = logging.DEBUG else: level = logging.INFO logging.basicConfig(level=level, format=log_format) if __name__ == "__main__": main()