forked from SumZer0-git/EDAPGui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
EDlogger.py
29 lines (22 loc) · 923 Bytes
/
EDlogger.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
import logging
import colorlog
# what level for root logger
logging.basicConfig(filename='autopilot.log', level=logging.ERROR)
logger = colorlog.getLogger('ed_log')
# Change this to debug if want to see debug lines in log file
logger.setLevel(logging.WARNING) # change to INFO for more... DEBUG for much more
handler = logging.StreamHandler()
handler.setLevel(logging.WARNING) # change this to what is shown on console
handler.setFormatter(
colorlog.ColoredFormatter('%(log_color)s%(levelname)-8s%(reset)s %(white)s%(message)s',
log_colors={
'DEBUG': 'fg_bold_cyan',
'INFO': 'fg_bold_green',
'WARNING': 'bg_bold_yellow,fg_bold_blue',
'ERROR': 'bg_bold_red,fg_bold_white',
'CRITICAL': 'bg_bold_red,fg_bold_yellow',
},secondary_log_colors={}
))
logger.addHandler(handler)
#logger.disabled = True
#logger.disabled = False