From c4b1705710d268f17b21c9547c510272a2acaba4 Mon Sep 17 00:00:00 2001 From: emkael Date: Tue, 30 Jul 2019 14:31:21 +0200 Subject: Adding debug log handler for testing purposes --- jfr_playoff/gui/logframe.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/jfr_playoff/gui/logframe.py b/jfr_playoff/gui/logframe.py index 1711d52..74ffca1 100644 --- a/jfr_playoff/gui/logframe.py +++ b/jfr_playoff/gui/logframe.py @@ -43,11 +43,21 @@ class LogWindow(tk.Toplevel): btnFrame, text='Wyczyść dziennik', command=self.resetRecords)).pack(side=tk.LEFT) + def _getGUIHandler(self): + return LogHandler(log.INFO, window=self) + + def _getConsoleHandler(self): + consoleHandler = log.StreamHandler() + consoleHandler.setFormatter( + log.Formatter( + '%(asctime)s - %(name)s - %(levelname)s - %(message)s')) + return consoleHandler + def _registerLogging(self): - logHandler = LogHandler(log.INFO, window=self) logger = log.getLogger() logger.setLevel(log.INFO) - logger.addHandler(logHandler) + for handler in [self._getConsoleHandler, self._getGUIHandler]: + logger.addHandler(handler()) def addRecord(self, record): self._counter += 1 -- cgit v1.2.3