def configure_logging(log_file_path):
"""Loads logging.conf file
Loads logging.conf file to create the logger configuration.
The logger configuration has two handlers, one of stream
(show logs in the console) and other of file (save a log file)
where you can choose one of it in [logger_root : handlers].
In it you can choose the logger level as well.
Level: Numeric value
---------------------
CRITICAL: 50
ERROR: 40
WARNING: 30
INFO: 20
DEBUG: 10
NOTSET: 00
---------------------
How to use: import logging and logging.exception('message')
Args:
log_file_path: logging.conf path.
Exception:
Exception: if logging.conf file not found.
"""
if os.path.isfile(log_file_path) is False:
raise Exception("Config file {} not found".format(log_file_path))
else:
logging.config.fileConfig(log_file_path)
评论列表
文章目录