]> SALOME platform Git repositories - tools/sat.git/commitdiff
Salome HOME
sat log: Add the full launched command in the hat file
authorSerge Rehbinder <serge.rehbinder@cea.fr>
Wed, 23 Nov 2016 14:03:08 +0000 (15:03 +0100)
committerSerge Rehbinder <serge.rehbinder@cea.fr>
Wed, 23 Nov 2016 14:03:08 +0000 (15:03 +0100)
commands/log.py
src/logger.py
src/xsl/hat.xsl

index a07c5211cdd8be74fe74f0def2741b523f3024f3..a63311bdd7684a4cd24c090d1e34359ef24f27a3 100644 (file)
@@ -225,7 +225,7 @@ def run(args, runner, logger):
                                    src.logger.log_macro_command_file_expression)
         lLogsFiltered = []
         for filePath, __, date, __, hour, cmd, __ in lLogs:
-            showLog, cmdAppli = src.logger.show_command_log(filePath, cmd, 
+            showLog, cmdAppli, __ = src.logger.show_command_log(filePath, cmd, 
                                 runner.cfg.VARS.application, notShownCommands)
             if showLog:
                 lLogsFiltered.append((filePath, date, hour, cmd, cmdAppli))
index bf5051ebaaca6f1a15b621280c845d3ffd3f86f3..eb2ee58b283a4b3e5e3a227e301ce1822f23f586 100644 (file)
@@ -287,7 +287,7 @@ def show_command_log(logFilePath, cmd, application, notShownCommands):
     # When the command is not in notShownCommands, no need to go further :
     # Do not show
     if cmd in notShownCommands:
-        return False, None
+        return False, None, None
  
     # Get the application of the log file
     try:
@@ -295,22 +295,23 @@ def show_command_log(logFilePath, cmd, application, notShownCommands):
     except Exception as e:
         msg = _("WARNING: the log file %s cannot be read:" % logFilePath)
         sys.stdout.write(printcolors.printcWarning("%s\n%s\n" % (msg, e)))
-        return False, None
+        return False, None, None
 
     if 'application' in logFileXml.xmlroot.keys():
         appliLog = logFileXml.xmlroot.get('application')
+        launched_cmd = logFileXml.xmlroot.find('Site').attrib['launchedCommand']
         # if it corresponds, then the log has to be shown
         if appliLog == application:
-            return True, appliLog
+            return True, appliLog, launched_cmd
         elif application != 'None':
-            return False, appliLog
+            return False, appliLog, launched_cmd
         
-        return True, appliLog
+        return True, appliLog, launched_cmd
     
     if application == 'None':
-            return True, None    
+            return True, None, None
         
-    return False, None
+    return False, None, None
 
 def list_log_file(dirPath, expression):
     '''Find all files corresponding to expression in dirPath
@@ -369,7 +370,7 @@ def update_hat_xml(logDir, application=None, notShownCommands = []):
     # then add it to the xml file
     lLogFile = list_log_file(logDir, log_macro_command_file_expression)
     for filePath, __, date, __, hour, cmd, __ in lLogFile:
-        showLog, cmdAppli = show_command_log(filePath, cmd,
+        showLog, cmdAppli, full_cmd = show_command_log(filePath, cmd,
                                               application, notShownCommands)
         #if cmd not in notShownCommands:
         if showLog:
@@ -379,7 +380,8 @@ def update_hat_xml(logDir, application=None, notShownCommands = []):
                                    attrib = {"date" : date, 
                                              "hour" : hour, 
                                              "cmd" : cmd, 
-                                             "application" : cmdAppli})
+                                             "application" : cmdAppli,
+                                             "full_command" : full_cmd})
     
     # Write the file on the hard drive
     xmlHat.write_tree('hat.xsl')
\ No newline at end of file
index 03a8b2fe91e3dad501db83f419e2f8d1727785b2..45ec1df9f23a6afc441cfecfe237b61b2cf393f9 100644 (file)
@@ -38,9 +38,9 @@
                                  </h1>
                          </xsl:otherwise>
                        </xsl:choose>
-                       <table border="0">
+                       <table border="1">
                                <tr>
-                               <td width="100px">Command</td><td width="100px">date</td><td width="100px">time</td><td>application</td>
+                               <td width="100px" bgcolor="Beige">Command</td><td width="100px" bgcolor="Beige">date</td><td width="100px" bgcolor="Beige">time</td><td bgcolor="Beige">application</td><td bgcolor="Beige">full command</td>
                                </tr>
                                <xsl:for-each select="LOGlist/LogCommand">
                                        <xsl:sort select="." order="descending" />
@@ -54,6 +54,7 @@
                                                <td><xsl:value-of select="@date"/></td>
                                                <td><xsl:value-of select="@hour"/></td>
                                                <td><xsl:value-of select="@application"/></td>
+                                               <td><xsl:value-of select="@full_command"/></td>
                                        </tr>
                                </xsl:for-each>
                        </table>