+
+ # If the last option is invoked, just, show the last log file
+ if options.last:
+ lastLogFilePath = get_last_log_file(logDir, notShownCommands)
+ if options.terminal:
+ # Show the log corresponding to the selected command call
+ print_log_command_in_terminal(lastLogFilePath, logger)
+ else:
+ # open the log xml file in the user editor
+ src.system.show_in_editor(runner.cfg.USER.browser,
+ lastLogFilePath, logger)
+ return 0
+
+ # If the user asks for a terminal display
+ if options.terminal:
+ # Parse the log directory in order to find
+ # all the files corresponding to the commands
+ lLogs = src.logger.list_log_file(logDir,
+ src.logger.logCommandFileExpression)
+ lLogsFiltered = []
+ for filePath, __, date, __, hour, cmd in lLogs:
+ showLog, cmdAppli = src.logger.show_command_log(filePath, cmd,
+ runner.cfg.VARS.application, notShownCommands)
+ if showLog:
+ lLogsFiltered.append((filePath, date, hour, cmd, cmdAppli))
+
+ lLogsFiltered = sorted(lLogsFiltered)
+ nb_logs = len(lLogsFiltered)
+ index = 0
+ # loop on all files and print it with date, time and command name
+ for __, date, hour, cmd, cmdAppli in lLogsFiltered:
+ num = src.printcolors.printcLabel("%2d" % (nb_logs - index))
+ logger.write("%s: %13s %s %s %s\n" %
+ (num, cmd, date, hour, cmdAppli), 1, False)
+ index += 1
+
+ # ask the user what for what command he wants to be displayed
+ x = -1
+ while (x < 0):
+ x = ask_value(nb_logs)
+ if x > 0:
+ index = len(lLogsFiltered) - int(x)
+ # Show the log corresponding to the selected command call
+ print_log_command_in_terminal(lLogsFiltered[index][0], logger)
+ x = 0
+
+ return 0
+
+ # Create or update the hat xml that gives access to all the commands log files
+ logger.write(_("Generating the hat log file (can be long) ... "), 3)
+ xmlHatFilePath = os.path.join(logDir, 'hat.xml')
+ src.logger.update_hat_xml(runner.cfg.USER.log_dir,
+ application = runner.cfg.VARS.application,
+ notShownCommands = notShownCommands)
+ logger.write(src.printcolors.printc("OK"), 3)
+ logger.write("\n", 3)