#!/usr/bin/env python import sys if __name__ == '__main__': if len(sys.argv)<2: sys.exit(0) filename = sys.argv[1] f = open(filename,"r") lines = f.readlines() f.close() fout = open(filename+".html","w") msglevels = ["FATAL", "ERROR", "WARNING", "DEBUG", "VERBOSE"] colors = { "FATAL": "#990000", "ERROR": "#FF0033", "WARNING": "#FF9933", "DEBUG": "#CCFFCC", "VERBOSE": "#FFCCCC" } print >>fout, '' print >>fout, '" print >>fout, """
""" % filename for l in lines: newline = l.rstrip('\n').replace("<","<").replace(">",">") colored=False for lvl in msglevels: if lvl in newline: newline = '""" fout.close()%s' % (lvl,newline) colored=True break #if not colored: # newline = newline+"
" print >>fout, newline print >>fout, """