From f82f2f82390ad48df3598674eab8968ef6caaff6 Mon Sep 17 00:00:00 2001 From: Johannes Findeisen Date: Tue, 29 Oct 2013 05:47:23 +0100 Subject: [PATCH] added "more" to log... --- linspector/frontends/lish.py | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/linspector/frontends/lish.py b/linspector/frontends/lish.py index 632c228..becccbe 100644 --- a/linspector/frontends/lish.py +++ b/linspector/frontends/lish.py @@ -254,15 +254,7 @@ Usage: pass def do_log(self, text): - 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() - elif text == "less": + if text == "less": try: # TODO: do the less on the logfile set by args and not a static path with open(os.path.dirname(os.path.abspath(__file__)) + "/../../log/linspector.log"): @@ -270,12 +262,29 @@ Usage: except IOError: self.print_color(RED, "Logfile not found.") self.help_log() + elif text == "more": + try: + # TODO: do the more 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("more " + os.path.dirname(os.path.abspath(__file__)) + "/../../log/linspector.log") + except IOError: + self.print_color(RED, "Logfile not found.") + self.help_log() + elif 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(''' Usage: less less on the linspector logfile (press "q" to exit) - tail tail on the linspector logfile (Ctrl+C to exit) + more more on the linspector logfile (press "q" to exit) + tail tail (-F) on the linspector logfile (Ctrl+C to exit) ''') def do_status(self, text):