File size: 446 Bytes
c6878c7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import logging

IMPORTANT_LEVEL_NUM = 25
logging.addLevelName(IMPORTANT_LEVEL_NUM, "IMPORTANT")

def important(self, message, *args, **kws):
    if self.isEnabledFor(IMPORTANT_LEVEL_NUM):
        self._log(IMPORTANT_LEVEL_NUM, message, args, **kws)

logging.Logger.important = important

logging.basicConfig(level=IMPORTANT_LEVEL_NUM, format='%(asctime)s - %(levelname)s - %(message)s')

def get_logger(name):
    return logging.getLogger(name)