aboutsummaryrefslogtreecommitdiffstats
path: root/miss_htbt_service/get_logger.py
diff options
context:
space:
mode:
authorSatoshi Fujii <fujii-satoshi@jp.fujitsu.com>2021-06-15 13:19:51 +0000
committerSatoshi Fujii <fujii-satoshi@jp.fujitsu.com>2021-06-18 07:40:41 +0000
commitd39331be3f55876a8a6fc31c5a10f2d68eefe0b0 (patch)
tree53a2009159f82d9e362f6d3204fb01a8c24756ee /miss_htbt_service/get_logger.py
parent6c8c23c92cc9e01a652599ca9d97ffdcfd4f4883 (diff)
Reformat code
Use 4 spaces for indentation and put spaces for better readability. Signed-off-by: Satoshi Fujii <fujii-satoshi@jp.fujitsu.com> Issue-ID: DCAEGEN2-2833 Change-Id: I99aa4df83a32b077e2a3f336d17b6b64184c3c12
Diffstat (limited to 'miss_htbt_service/get_logger.py')
-rw-r--r--miss_htbt_service/get_logger.py9
1 files changed, 4 insertions, 5 deletions
diff --git a/miss_htbt_service/get_logger.py b/miss_htbt_service/get_logger.py
index c94e333..bc8fea0 100644
--- a/miss_htbt_service/get_logger.py
+++ b/miss_htbt_service/get_logger.py
@@ -20,23 +20,22 @@ import logging.handlers
'''Configures the module root logger'''
root = logging.getLogger()
if root.handlers:
- #root.handlers.clear()
+ # root.handlers.clear()
del root.handlers[:]
formatter = logging.Formatter('%(asctime)s | %(name)s | %(module)s | %(funcName)s | %(lineno)d | %(levelname)s | %(message)s')
handler = logging.StreamHandler()
handler.setFormatter(formatter)
root.addHandler(handler)
-fhandler = logging.handlers.RotatingFileHandler('./hb_logs.txt', maxBytes=(1048576*5), backupCount=10)
+fhandler = logging.handlers.RotatingFileHandler('./hb_logs.txt', maxBytes=(1048576 * 5), backupCount=10)
fhandler.setFormatter(formatter)
root.addHandler(fhandler)
root.setLevel("DEBUG")
+
class BadEnviornmentENVNotFound(Exception):
pass
+
def get_logger(module=None):
'''Returns a module-specific logger or global logger if the module is None'''
return root if module is None else root.getChild(module)
-
-
-