logger.py 381 B

12345678910111213
  1. import logging
  2. class Logger:
  3. def __init__(self):
  4. self.logger = logging.getLogger("exampleApp")
  5. self.logger.setLevel(logging.INFO)
  6. fh = logging.FileHandler('logs/info.log')
  7. fh.setFormatter(logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s'))
  8. self.logger.addHandler(fh)
  9. self.logger.info("Program started")