diff --git a/bot.py b/bot.py index 99572df..e302d97 100644 --- a/bot.py +++ b/bot.py @@ -8,14 +8,25 @@ from handlers import pipisa, time_new_year, start_help from othersq import sendnot + +class TagFilter(logging.Filter): + def __init__(self): + self.tag = 'jack_bot' + + def filter(self, record): + record.tag = self.tag + return True + + logging.basicConfig(level=logging.DEBUG) root_logger = logging.getLogger( ) handler = graypy.GELFUDPHandler('localhost', 12201) -root_logger.addHandler(handler) -logging.LoggerAdapter(root_logger, {'tag': 'jack_bot'}) +root_logger.addHandler(handler) +root_logger.addFilter(TagFilter()) + pipisa.register_handlers_pipisa(dp)