added "more" to log...

This commit is contained in:
Johannes Findeisen 2013-10-29 05:47:23 +01:00
commit f82f2f8239

View file

@ -254,15 +254,7 @@ Usage:
pass pass
def do_log(self, text): def do_log(self, text):
if text == "tail": if text == "less":
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":
try: try:
# TODO: do the less on the logfile set by args and not a static path # 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"): with open(os.path.dirname(os.path.abspath(__file__)) + "/../../log/linspector.log"):
@ -270,12 +262,29 @@ Usage:
except IOError: except IOError:
self.print_color(RED, "Logfile not found.") self.print_color(RED, "Logfile not found.")
self.help_log() 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): def help_log(self):
print(''' print('''
Usage: Usage:
less less on the linspector logfile (press "q" to exit) 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): def do_status(self, text):