logger.py 319 B

12345678910
  1. import logging
  2. class log:
  3. #Initialize logger
  4. logger = logging.getLogger('app')
  5. hdlr = logging.FileHandler('App.log',mode='w')
  6. formatter = logging.Formatter('%(asctime)s %(name)s %(levelname)s %(message)s')
  7. hdlr.setFormatter(formatter)
  8. logger.addHandler(hdlr)
  9. logger.setLevel(logging.DEBUG)