Salome HOME
error if dev mode for product is incompatible with 'sub_dir' option
[tools/sat.git] / commands / log.py
index ed7439eece700fe01d3cd01fcdd3f35cf047995a..d8def14303da1197ca3abf5f33a2a00c8714a310 100644 (file)
@@ -193,8 +193,12 @@ def description():
     :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.
@@ -203,7 +207,7 @@ def run(args, runner, logger):
     (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, "*")))
@@ -257,11 +261,13 @@ def run(args, runner, logger):
     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:
@@ -322,7 +328,7 @@ def run(args, runner, logger):
     # 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)
@@ -332,4 +338,4 @@ def run(args, runner, logger):
     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