More deferred logging tweaks
authorJack Miller <jack@codezen.org>
Mon, 17 Nov 2014 16:30:14 +0000 (10:30 -0600)
committerJack Miller <jack@codezen.org>
Mon, 17 Nov 2014 16:30:14 +0000 (10:30 -0600)
- Fix emit
- Fix exception on gui thread startup

canto_curses/gui.py

index 2e195fc..c7f5410 100644 (file)
@@ -57,7 +57,7 @@ class GraphicalLog(logging.Handler):
 
     def flush_deferred_logs(self):
         for record in self.deferred_logs:
-            self.glog_handler.emit(record)
+            self.emit(record)
             self.deferred_logs = []
 
 class GuiPlugin(Plugin):
@@ -104,11 +104,12 @@ class CantoCursesGui(CommandHandler):
         self.screen = Screen(self.callbacks)
         self.screen.refresh()
 
+        self.glog_handler = GraphicalLog(self.callbacks, self.screen)
+
         self.graphical_thread = Thread(target = self.run_gui)
         self.graphical_thread.daemon = True
         self.graphical_thread.start()
 
-        self.glog_handler = GraphicalLog(self.callbacks, self.screen)
         rootlog = logging.getLogger()
         rootlog.addHandler(self.glog_handler)