summaryrefslogtreecommitdiff
path: root/jfr_playoff/gui/logframe.py
diff options
context:
space:
mode:
authoremkael <emkael@tlen.pl>2019-07-30 14:31:21 +0200
committeremkael <emkael@tlen.pl>2019-07-30 14:31:21 +0200
commitc4b1705710d268f17b21c9547c510272a2acaba4 (patch)
tree0c8c6b7c98b1c6147caf4ae622aed830b518e1c6 /jfr_playoff/gui/logframe.py
parentb4bf2e464dc3f01f2ced9189f0ba22748574bfe1 (diff)
Adding debug log handler for testing purposes
Diffstat (limited to 'jfr_playoff/gui/logframe.py')
-rw-r--r--jfr_playoff/gui/logframe.py14
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