def run(self): # Clear the default logging so we can use our own format rootLogger = logging.getLogger() list(map(rootLogger.removeHandler, rootLogger.handlers[:])) list(map(rootLogger.removeFilter, rootLogger.filters[:])) logging.getLogger().setLevel(logging.DEBUG) ## send the log to STDERR try: console_handler = logging.StreamHandler() console_handler.setFormatter( logging.Formatter( "%(asctime)s %(levelname)s:%(name)s:%(message)s")) console_handler.setLevel( logging.DEBUG if self.debug else logging.ERROR) logging.getLogger().addHandler(console_handler) except: # if there's no console, this fails pass ## capture log in memory mem_handler = logging.StreamHandler(self.application_log) mem_handler.setFormatter( logging.Formatter( "%(asctime)s %(levelname)s:%(name)s:%(message)s")) mem_handler.setLevel(logging.DEBUG) logging.getLogger().addHandler(mem_handler) ## and display gui messages for exceprions gui_handler = multiprocess_logging.CallbackHandler( lambda msg, app=self: gui_handler_callback(msg, app)) gui_handler.setLevel(logging.ERROR) logging.getLogger().addHandler(gui_handler) # must redirect to the gui thread self.on_trait_change(self.show_error, 'application_error', dispatch='ui') # set up the model self.model = Workflow(remote_connection=self.remote_connection, debug=self.debug) # and the shared central pane self.plot_pane = FlowTaskPane(model=self.model) # run the GUI super(CytoflowApplication, self).run()
def run(self): # set the root logger level to DEBUG; decide what to do with each # message on a handler-by-handler basis logging.getLogger().setLevel(logging.DEBUG) ## send the log to STDERR try: console_handler = logging.StreamHandler() console_handler.setFormatter( logging.Formatter( "%(asctime)s %(levelname)s:%(name)s:%(message)s")) console_handler.setLevel( logging.DEBUG if self.debug else logging.ERROR) logging.getLogger().addHandler(console_handler) except: # if there's no console, this fails pass ## capture log in memory mem_handler = logging.StreamHandler(self.application_log) mem_handler.setFormatter( logging.Formatter( "%(asctime)s %(levelname)s:%(name)s:%(message)s")) mem_handler.setLevel(logging.DEBUG) logging.getLogger().addHandler(mem_handler) ## and display gui messages for exceptions gui_handler = CallbackHandler( lambda rec, app=self: gui_handler_callback(rec.getMessage(), app)) gui_handler.setLevel(logging.ERROR) logging.getLogger().addHandler(gui_handler) # must redirect to the gui thread self.on_trait_change(self.show_error, 'application_error', dispatch='ui') # set up the model self.model = Workflow(remote_connection=self.remote_connection, debug=self.debug) # and the shared central pane self.plot_pane = FlowTaskPane(model=self.model) # run the GUI super(CytoflowApplication, self).run()
def create_central_pane(self): self.view = FlowTaskPane(model=self.model) return self.view