diff options
Diffstat (limited to 'jfr_playoff/gui/logframe.py')
-rw-r--r-- | jfr_playoff/gui/logframe.py | 14 |
1 files 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 |