cfabio

Logger.py

Jan 7th, 2019
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.52 KB | None | 0 0
  1. import logging
  2.  
  3. #configuration of the logger
  4. logging.basicConfig(
  5.     level=logging.DEBUG,
  6.     format='%(asctime)s - %(levelname)s - %(message)s')
  7.  
  8. #log a message
  9. logging.debug(
  10.     'start of program %s, with input'
  11.     % (name, inputVal))
  12.  
  13. #disale the logging under the level in input
  14. logging.disable(logging.CRITICAL)
  15.  
  16.  
  17.  
  18. #configuration of the logger, with output in log file
  19. logging.basicConfig(
  20.     filename='logfile.log',
  21.     level=logging.DEBUG,
  22.     format='%(asctime)s - %(levelname)s - %(message)s')
Advertisement
Add Comment
Please, Sign In to add comment