From 42c5d5d29af7d4ad7783e3de3583d95c46e53f10 Mon Sep 17 00:00:00 2001 From: Johannes Findeisen Date: Mon, 28 Oct 2013 03:54:19 +0100 Subject: [PATCH] added "tail" command to do_log in lish --- linspector/frontends/lish.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/linspector/frontends/lish.py b/linspector/frontends/lish.py index a9e60fd..8b8a295 100644 --- a/linspector/frontends/lish.py +++ b/linspector/frontends/lish.py @@ -241,10 +241,18 @@ class LishCommander(Exit): pass def do_log(self, text): - pass + if text == "tail": + try: + # TODO: do the tail on the logfile set by args and not a static path + with open(os.path.dirname(os.path.abspath(__file__)) + "/../../log/linspector.log"): + os.system("tail -F " + os.path.dirname(os.path.abspath(__file__)) + "/../../log/linspector.log") + except IOError: + self.print_color(RED, "Logfile not found.") + self.help_log() def help_log(self): - print('''Manage logging''') + print('''Usage: + tail: Do a "tail -F" on the linspector logfile (Ctrl+C to exit)''') def do_status(self, text): # TODO: print instance name from core config