-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathlogger.py
38 lines (35 loc) · 958 Bytes
/
logger.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
import logging
import logging.config
logger_config = {
"version": 1,
"disable_existing_loggers": False,
"formatters": {
"standard": {
"format": "%(asctime)s [%(levelname)s] %(module)s lineno=%(lineno)d: %(message)s",
},
},
"handlers": {
"file_handler": {
"class": "logging.handlers.RotatingFileHandler",
"filename": "../logs/app.log",
"maxBytes": 100_000_000,
"backupCount": 10,
"formatter": "standard",
"level": "INFO",
},
"stream_handler": {
"class": "logging.StreamHandler",
"formatter": "standard",
"level": "DEBUG",
},
},
"loggers": {
"": {
"handlers": ["file_handler", "stream_handler"],
"level": "DEBUG",
"propagate": False,
}
},
}
def init_logger():
logging.config.dictConfig(logger_config)