From: Serge Rehbinder Date: Mon, 15 Feb 2016 13:57:04 +0000 (+0100) Subject: add the launched command to the log X-Git-Tag: sprint-02bis~10 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=a47d99a8f281612821507d1f1c0b00f4c23be6c4;p=tools%2Fsat.git add the launched command to the log --- diff --git a/salomeTools.py b/salomeTools.py index 3225920..5e697ed 100755 --- a/salomeTools.py +++ b/salomeTools.py @@ -88,6 +88,7 @@ class Sat(object): # initialization of class attributes self.__dict__ = dict() self.cfg = None # the config that will be read using pyconf module + self.arguments = opt self.options = options # the options passed to salomeTools self.dataDir = dataDir # default value will be /data # set the commands by calling the dedicated function @@ -157,7 +158,8 @@ class Sat(object): res = __module__.run(argv, self, logger_command) finally: # put final attributes in xml log file (end time, total time, ...) and write it - logger_command.endWrite() + launchedCommand = ' '.join([self.cfg.VARS.salometoolsway + os.path.sep + 'sat', self.arguments.split(' ')[0], args]) + logger_command.endWrite({"launchedCommand" : launchedCommand}) return res diff --git a/src/logger.py b/src/logger.py index 6568e57..2fa3c43 100644 --- a/src/logger.py +++ b/src/logger.py @@ -115,7 +115,7 @@ class Logger(object): ''' sys.stdout.flush() - def endWrite(self): + def endWrite(self, attribute): '''Method called just after command end : Put all fields corresponding to the command end context (time). Write the log xml file on the hard drive. And display the command to launch to get the log @@ -142,6 +142,9 @@ class Logger(object): self.xmlFile.append_node_attrib("Site", attrib={"endTime" : endtime}) self.xmlFile.append_node_attrib("Site", attrib={"TotalTime" : "%ih%im%is" % (hours, minutes, seconds)}) + # Add the attribute passed to the method + self.xmlFile.append_node_attrib("Site", attrib=attribute) + # Call the method to write the xml file on the hard drive self.xmlFile.write_tree(stylesheet = "command.xsl")