1234567891011121314151617181920 |
- #!/usr/bin/env python
- from os import environ
- import logging
-
- FORMAT = '[%(asctime)s][%(levelname)s][%(name)s][%(funcName)s](l.%(lineno)d) %(message)s'
- logging.basicConfig(
- format=FORMAT,
- level=environ.get('LOGLEVEL', logging.INFO))
- logger = None
-
- def logger_init():
- global logger
- flag = not logger
- logger = logging.getLogger('pyheatpump')
- if flag:
- logger.info('Initialized pyHeatpump')
- return logger
-
- if __name__ == '__main__':
- logger_init()
|