logResult.py 680 B

12345678910111213141516
  1. # import logging
  2. # logger = logging.getLogger(__name__)
  3. # logger.setLevel(level = logging.INFO)
  4. # handler = logging.FileHandler("logs/result.txt")
  5. # handler.setLevel(logging.INFO)
  6. # formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
  7. # handler.setFormatter(formatter)
  8. # logger.addHandler(handler)
  9. import logging
  10. from mpFileLog import MPFileLogHandler
  11. logger_handler = MPFileLogHandler('logs/result.txt')
  12. logger = logging.getLogger('result')
  13. formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
  14. logger_handler.setFormatter(formatter)
  15. logger.addHandler(logger_handler)
  16. logger.setLevel(logging.ERROR)