# Construct xml log file location for sat prints.
logFileName = config.VARS.datehour + "_" + config.VARS.command + ".xml"
- logFilePath = os.path.join(config.SITE.log.log_dir, logFileName)
+ logFilePath = os.path.join(config.USER.log_dir, logFileName)
# Construct txt file location in order to log
# the external commands calls (cmake, make, git clone, etc...)
txtFileName = config.VARS.datehour + "_" + config.VARS.command + ".txt"
- txtFilePath = os.path.join(config.SITE.log.log_dir, "OUT", txtFileName)
+ txtFilePath = os.path.join(config.USER.log_dir, "OUT", txtFileName)
src.ensure_path_exists(os.path.dirname(logFilePath))
src.ensure_path_exists(os.path.dirname(txtFilePath))
# command
self.xmlFile.add_simple_node("Links")
+ def add_link(self,
+ log_file_name,
+ command_name,
+ command_res,
+ full_launched_command):
+ '''Add a link to another log file.
+
+ :param log_file_name str: The file name of the link.
+ :param command_name str: The name of the command linked.
+ :param command_res str: The result of the command linked. "0" or "1"
+ :parma full_launched_command str: The full lanch command
+ ("sat command ...")
+ '''
+ xmlLinks = self.xmlFile.xmlroot.find("Links")
+ src.xmlManager.add_simple_node(xmlLinks,
+ "link",
+ text = log_file_name,
+ attrib = {"command" : command_name,
+ "passed" : command_res,
+ "launchedCommand" : full_launched_command})
+
def write(self, message, level=None, screenOnly=False):
'''the function used in the commands
that will print in the terminal and the log file.
else:
if self.default_level <= current_output_verbose_level and not self.silentSysStd:
sys.stdout.write(message)
+ self.flush()
def error(self, message):
'''Print an error.
self.xmlFile.write_tree(stylesheet = "command.xsl")
# Dump the config in a pyconf file in the log directory
- logDir = self.config.SITE.log.log_dir
+ logDir = self.config.USER.log_dir
dumpedPyconfFileName = (self.config.VARS.datehour
+ "_"
+ self.config.VARS.command
return False, None
# Get the application of the log file
- logFileXml = src.xmlManager.ReadXmlFile(logFilePath)
+ try:
+ logFileXml = src.xmlManager.ReadXmlFile(logFilePath)
+ 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
if 'application' in logFileXml.xmlroot.keys():
appliLog = logFileXml.xmlroot.get('application')