From d88728bb711e5c3081852f1f4cec1e142df16f94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krist=C3=B3f=20T=C3=B3th?= Date: Mon, 5 Mar 2018 16:36:59 +0100 Subject: [PATCH] Implement command logging as exampe for HistoryMonitor usage --- src/demo/event_handler_main.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/demo/event_handler_main.py b/src/demo/event_handler_main.py index 890bee0..8500d09 100644 --- a/src/demo/event_handler_main.py +++ b/src/demo/event_handler_main.py @@ -1,14 +1,17 @@ +from tornado.ioloop import IOLoop + from tfw.components.source_code_event_handler import SourceCodeEventHandler from tfw.components.terminado_event_handler import TerminadoEventHandler from tfw.components.process_managing_event_handler import ProcessManagingEventHandler -from tornado.ioloop import IOLoop - from tfw.config import tfwenv +from tfw.config.logs import logging +log = logging.getLogger(__name__) if __name__ == '__main__': ide = SourceCodeEventHandler('webide', tfwenv.WEBIDE_WD) terminado = TerminadoEventHandler('shell') + terminado.historymonitor.callbacks.append(lambda hist: log.debug('User executed command: "{}"'.format(hist[-1]))) processmanager = ProcessManagingEventHandler('processmanager', ide.monitor) eventhandlers = {ide, terminado, processmanager}