logger.py 449 B

12345678910111213141516171819
  1. import logging
  2. from .base import DEBUG
  3. from .base import BASE_DIR
  4. LOGFILE = None
  5. FMT = '%(levelname)s - [%(asctime)s] %(filename)s:%(lineno)d [%(funcName)s]: %(message)s'
  6. if DEBUG:
  7. level = logging.DEBUG
  8. else:
  9. level = logging.INFO
  10. level = logging.INFO
  11. logging.basicConfig(format=FMT, level=level, filename=LOGFILE, filemode="w")
  12. logging.info("Running in {} mode".format("DEBUG" if DEBUG else "PRODUCTION"))
  13. logging.info(f"{BASE_DIR=}")