buildframework/helium/sf/python/pythoncore/lib/log2xml.py
changeset 645 b8d81fa19e7d
parent 628 7c4a911dc066
equal deleted inserted replaced
643:27cf35f95864 645:b8d81fa19e7d
   172             self.__stream.write("%s<message priority=\"%s\"><![CDATA[%s]]></message>\n" % (self.__indent+"\t", priority, acdata))
   172             self.__stream.write("%s<message priority=\"%s\"><![CDATA[%s]]></message>\n" % (self.__indent+"\t", priority, acdata))
   173         except UnicodeDecodeError, exc:
   173         except UnicodeDecodeError, exc:
   174             print exc
   174             print exc
   175 
   175 
   176 
   176 
   177 def convert(inputfile, outputfile, fulllogging=True, configuration=DEFAULT_CONFIGURATION):
   177 def convert(inputfile, outputfile, fulllogging=True, configuration=None):
   178     """ Convert an input log into an XML log and write an outputfile. """
   178     """ Convert an input log into an XML log and write an outputfile. """
   179     
   179     if configuration == None:
       
   180         configuration = DEFAULT_CONFIGURATION
       
   181         
   180     # Compiling the regexp  
   182     # Compiling the regexp  
   181     built_config = {}
   183     built_config = {}
   182     for category in configuration.keys():
   184     for category in configuration.keys():
   183         built_config[category] = []
   185         built_config[category] = []
   184         for rule in configuration[category]:
   186         for rule in configuration[category]:
   241             if (fulllogging or priority != 'stdout'):
   243             if (fulllogging or priority != 'stdout'):
   242                 xmllog.message(priority, line)
   244                 xmllog.message(priority, line)
   243     # end file
   245     # end file
   244     xmllog.close()
   246     xmllog.close()
   245     
   247     
   246 def convert_old(inputfile, outputfile, fulllogging=True, configuration=DEFAULT_CONFIGURATION):
   248 def convert_old(inputfile, outputfile, fulllogging=True, configuration=None):
   247     """ Convert an input log into an XML log and write an outputfile. """
   249     """ Convert an input log into an XML log and write an outputfile. """
   248     
   250     if configuration == None:
       
   251         configuration = DEFAULT_CONFIGURATION
       
   252         
   249     # Compiling the regexp  
   253     # Compiling the regexp  
   250     built_config = {}
   254     built_config = {}
   251     for category in configuration.keys():
   255     for category in configuration.keys():
   252         built_config[category] = []
   256         built_config[category] = []
   253         for rule in configuration[category]:
   257         for rule in configuration[category]: