Improve log formatting
This commit is contained in:
parent
4cf7b93ee2
commit
f50af4f2aa
2 changed files with 11 additions and 3 deletions
|
@ -685,18 +685,26 @@ if ENABLE_LOGGING:
|
|||
custom_handler_item = {
|
||||
'custom_file': {
|
||||
'level': LOG_LEVEL,
|
||||
'class': 'logging.FileHandler',
|
||||
'class': 'logging.handlers.RotatingFileHandler',
|
||||
'filename':
|
||||
"{PROJECT_DIR}/{LEVEL}.log".format(
|
||||
"{PROJECT_DIR}/logs/{LEVEL}.log".format(
|
||||
LEVEL=LOG_LEVEL.lower(),
|
||||
PROJECT_DIR=PROJECT_DIR
|
||||
)
|
||||
),
|
||||
'maxBytes': 1024 * 1024 * 5,
|
||||
'backupCount': 10,
|
||||
'formatter': 'standard',
|
||||
}
|
||||
}
|
||||
handlers_dict.update(custom_handler_item)
|
||||
LOGGING = {
|
||||
'version': 1,
|
||||
'disable_existing_loggers': False,
|
||||
'formatters': {
|
||||
'standard': {
|
||||
'format': '%(asctime)s %(levelname)s %(name)s: %(message)s'
|
||||
}
|
||||
},
|
||||
'handlers': handlers_dict,
|
||||
'loggers': loggers_dict
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue