:return: The text to display for the log command description.
:rtype: str
'''
- return _("Gives access to the logs produced by the salomeTools commands.\n"
- "\nexample:\nsat log")
+ return _("""\
+The log command gives access to the logs produced by the salomeTools commands.
+
+example:
+>> sat log
+""")
def run(args, runner, logger):
'''method that is called when salomeTools is called with log parameter.
(options, args) = parser.parse_args(args)
# get the log directory.
- logDir = runner.cfg.USER.log_dir
+ logDir = src.get_log_path(runner.cfg)
# Print a header
nb_files_log_dir = len(glob.glob(os.path.join(logDir, "*")))
imgLogo = os.path.join(xslDir, "LOGO-SAT.png")
# copy the stylesheets in the log directory
- shutil.copy2(xslCommand, logDir)
- shutil.copy2(xslHat, logDir)
+ # OP We use copy instead of copy2 to update the creation date
+ # So we can clean the LOGS directories easily
+ shutil.copy(xslCommand, logDir)
+ shutil.copy(xslHat, logDir)
src.ensure_path_exists(os.path.join(logDir, "TEST"))
- shutil.copy2(xsltest, os.path.join(logDir, "TEST"))
- shutil.copy2(imgLogo, logDir)
+ shutil.copy(xsltest, os.path.join(logDir, "TEST"))
+ shutil.copy(imgLogo, logDir)
# If the last option is invoked, just, show the last log file
if options.last_terminal:
# 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,
+ src.logger.update_hat_xml(logDir,
application = runner.cfg.VARS.application,
notShownCommands = notShownCommands)
logger.write(src.printcolors.printc("OK"), 3)
if not options.no_browser:
logger.write(_("\nOpening the log file\n"), 3)
src.system.show_in_editor(runner.cfg.USER.browser, xmlHatFilePath, logger)
- return 0
\ No newline at end of file
+ return 0