-
Notifications
You must be signed in to change notification settings - Fork 0
/
logging_config.py
42 lines (39 loc) · 1.16 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
from datetime import date
# Ref: https://scicomp.ethz.ch/public/manual/Python/3.4.3/howto-logging-cookbook.pdf
logs_target = "_logs/logfile_" + str(date.today()) + ".log"
logging_schema = {
"version": 1,
"formatters": {
"standard": {
"class": "logging.Formatter",
"format": "%(levelname)s | %(name)s | %(asctime)s | %(message)s",
"datefmt": "%m/%d/%Y %I:%M:%S %p",
}
},
"handlers": {
"console": {
"class": "logging.StreamHandler",
"formatter": "standard",
"level": "DEBUG",
"stream": "ext://sys.stdout",
},
"file": {
"class": "logging.handlers.RotatingFileHandler",
"formatter": "standard",
"level": "INFO",
"filename": logs_target,
"mode": "a",
"encoding": "utf-8",
"maxBytes": 500000,
"backupCount": 4,
},
},
"loggers": {
"priLogger": {
"handlers": ["console", "file"],
"level": "DEBUG",
"propagate": False,
}
},
"root": {"level": "INFO", "handlers": ["console"]},
}