diff options
Diffstat (limited to 'utils/logger.py')
-rw-r--r-- | utils/logger.py | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/utils/logger.py b/utils/logger.py index 0f93bca7..80392f59 100644 --- a/utils/logger.py +++ b/utils/logger.py @@ -19,14 +19,14 @@ import logging import os -# from bottlenecks_cfg import Bottlenecks_cfg as bn_cfg +from utils.parser import Parser as conf class Logger: def __init__(self, logger_name): - #if user set --debug as a cli parameter - #we will set this variable “Debug” to output debug info. + # if user set --debug as a cli parameter + # we will set this variable "Debug" to output debug info. DEBUG = os.getenv('DEBUG') self.logger = logging.getLogger(logger_name) @@ -47,13 +47,15 @@ class Logger: ch.setLevel(logging.INFO) self.logger.addHandler(ch) -# result_path = bn_cfg.['log_dir'] -# if not os.path.exists(result_path): -# os.makedirs(result_path) - hdlr = logging.FileHandler('/tmp/bottlenecks.log') + result_path = conf.bottlenecks_config["log_dir"] + if not os.path.exists(result_path): + os.makedirs(result_path) + result_file = os.path.join(result_path, 'bottlenecks.log') + hdlr = logging.FileHandler(result_file) + hdlr.setFormatter(formatter) hdlr.setLevel(logging.DEBUG) self.logger.addHandler(hdlr) def getLogger(self): - return self.logger
\ No newline at end of file + return self.logger |