logger.py 305 B

12345678910111213
  1. import logging
  2. import sys
  3. logger = logging.getLogger(__name__)
  4. logger.setLevel(logging.INFO)
  5. handler = logging.StreamHandler(sys.stdout)
  6. handler.setLevel(logging.INFO)
  7. formatter = logging.Formatter('%(asctime)s - %(levelname)s - %(message)s')
  8. handler.setFormatter(formatter)
  9. logger.addHandler(handler)