This repository has been archived by the owner on Aug 16, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 40
/
logging_config.py
86 lines (85 loc) · 2.67 KB
/
logging_config.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# Logging setup
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'formatters': {
'standard': {
'format': '%(asctime)s [%(levelname)s] %(message)s',
# 'format': '%(asctime)s [%(levelname)s] %(name)s: %(message)s',
'datefmt': '%d-%m-%Y %H:%M:%S',
},
'info_logger_format': {
'format': '%(asctime)s %(message)s',
'datefmt': '%d-%m-%Y %H:%M:%S'
},
'colored': {
'()': 'colorlog.ColoredFormatter',
# 'format': "%(asctime)s - %(name)s: %(log_color)s%(levelname)-4s%(reset)s %(blue)s%(message)s",
'format': "%(asctime)s - %(log_color)s%(levelname)-4s%(reset)s %(blue)s%(message)s",
'datefmt': '%d-%m-%Y %H:%M:%S'
},
},
'handlers': {
'default': {
'level': 'INFO',
'class': 'logging.handlers.RotatingFileHandler',
'filename': 'logs/info.log',
'maxBytes': 1024*1024*5, # 5MB
'backupCount': 5,
'formatter': 'standard',
},
'debug_console_handler': {
'level': 'DEBUG',
'formatter': 'colored',
'class': 'logging.StreamHandler',
'stream': 'ext://sys.stdout',
},
'repaying': {
'level': 'INFO',
'class': 'logging.handlers.RotatingFileHandler',
'filename': 'logs/repayments.log',
'maxBytes': 1024 * 1024 * 5, # 5MB
'backupCount': 5,
'formatter': 'info_logger_format'
},
'apscheduler': {
'level': 'INFO',
'class': 'logging.handlers.RotatingFileHandler',
'filename': 'logs/apscheduler.log',
'maxBytes': 1024 * 1024 * 5, # 5MB
'backupCount': 5,
},
'werkzeug': {
'level': 'INFO',
'class': 'logging.handlers.RotatingFileHandler',
'filename': 'logs/werkzeug.log',
'maxBytes': 1024 * 1024 * 5, # 5MB
'backupCount': 5,
},
},
'loggers': {
'': {
'handlers': ['default', 'debug_console_handler'],
'level': 'INFO',
'propagate': True,
},
'repaying': {
'handlers': ['repaying'],
'level': 'INFO',
'propagate': False,
},
'apscheduler': {
'handlers': ['apscheduler'],
'level': 'INFO',
'propagate': False,
},
'werkzeug': {
'handlers': ['werkzeug'],
'level': 'INFO',
'propagate': False,
},
'urllib3.connectionpool': {
'level': 'WARNING',
}
},
}