siddharth-chat / custom_logging.py
siddharth414's picture
Initial commit
c6878c7
Raw
History Blame Contribute Delete
446 Bytes
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)