def connect_logging(self, host='localhost', port=logging.handlers.DEFAULT_TCP_LOGGING_PORT, handler=_LogRecordStreamHandler): self.log_receiver = LogRecordSocketReceiver(host=host, port=port, handler=handler, model=self) self.log_thread = threading.Thread( target=self.log_receiver.serve_until_stopped) self.log_thread.daemon = False self.log_thread.start()
class QRemoteLoggingTableModel(QLoggingTableModel): """A remote Qt table that displays the taurus logging messages""" def connect_logging(self, host='localhost', port=logging.handlers.DEFAULT_TCP_LOGGING_PORT, handler=_LogRecordStreamHandler): self.log_receiver = LogRecordSocketReceiver(host=host, port=port, handler=handler, model=self) self.log_thread = threading.Thread( target=self.log_receiver.serve_until_stopped) self.log_thread.daemon = False self.log_thread.start() def disconnect_logging(self): if not hasattr(self, 'log_receiver') or self.log_receiver is None: return self.log_receiver.stop() self.log_thread.join() del self.log_receiver