Browse Source

[logs] added a logger module

Maxime Alves LIRMM@home 4 years ago
parent
commit
8050b9e9c4
1 changed files with 17 additions and 0 deletions
  1. 17
    0
      pyheatpump/logger.py

+ 17
- 0
pyheatpump/logger.py View File

@@ -0,0 +1,17 @@
1
+#!/usr/bin/env python
2
+
3
+import logging
4
+
5
+FORMAT = '[%(asctime)s][%(levelname)s][%(name)s][%(funcName)s](l.%(lineno)d) %(message)s'
6
+logging.basicConfig(
7
+    format=FORMAT,
8
+    level=logging.DEBUG)
9
+logger = None
10
+
11
+def logger_init():
12
+    if 'logger' not in locals() or not logger:
13
+        logger = logging.getLogger('pyheatpump')
14
+        logger.info('Initialized pyHeatpump')
15
+
16
+if __name__ == '__main__':
17
+    logger_init()

Loading…
Cancel
Save