Projet de remplacement du "RPiPasserelle" d'Otec.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

logger.py 482B

1234567891011121314151617181920
  1. #!/usr/bin/env python
  2. from os import environ
  3. import logging
  4. FORMAT = '[%(asctime)s][%(levelname)s][%(name)s][%(funcName)s](l.%(lineno)d) %(message)s'
  5. logging.basicConfig(
  6. format=FORMAT,
  7. level=environ.get('LOGLEVEL', logging.INFO))
  8. logger = None
  9. def logger_init():
  10. global logger
  11. flag = not logger
  12. logger = logging.getLogger('pyheatpump')
  13. if flag:
  14. logger.info('Initialized pyHeatpump')
  15. return logger
  16. if __name__ == '__main__':
  17. logger_init()