removed the usage of logzero, added a formal logging configuration file using json
This commit is contained in:
parent
59e6b6630a
commit
742ad0e3a2
3 changed files with 33 additions and 8 deletions
|
@ -1,9 +1,14 @@
|
|||
import logzero
|
||||
import json
|
||||
import logging
|
||||
import logging.config
|
||||
import os
|
||||
|
||||
# configure custom format with function name
|
||||
_format_template = "%(color)s[%(levelname)1.1s %(asctime)s %(module)s:%(funcName)s:" \
|
||||
"%(lineno)d]%(end_color)s %(message)s"
|
||||
_formatter = logzero.LogFormatter(fmt=_format_template)
|
||||
logzero.formatter(_formatter)
|
||||
from core import constants
|
||||
|
||||
logger = logzero.logger
|
||||
log_config_path = os.path.join(constants.CORE_CONF_DIR, "logging.conf")
|
||||
with open(log_config_path, "r") as log_config_file:
|
||||
log_config = json.load(log_config_file)
|
||||
logging.config.dictConfig(log_config)
|
||||
|
||||
#logging.basicConfig(format="%(asctime)s - %(levelname)s - %(module)s:%(funcName)s - %(message)s", level=logging.DEBUG)
|
||||
logger = logging.getLogger()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue