Import re
Warninglist = []
Warninglist.append ("Warning Cd{4}")
Errorlist = []
Errorlist.append ("Error lnkd{4}")
Errorlist.append ("Error cd{4}")
Def parse (logfile, regexlist):
Resultlines = []
With open (logfile, "R") as log:
For line in log:
For regex in Regexlist:
m = Re.search (regex, line)
If M:
Resultlines.append (line)
Return Resultlines
def parsewarning (logfile):
warnings = []
Warnings = Parse (logfile, warninglist)
Return warnings
def parseerror (logfile):
Errors = []
Errors = Parse (logfile, errorlist)
return errors
WS = Parsewarning ("Buildlog.txt")
Print ("Warnings:" + str (len (WS)))
For W in WS:
Print (W)
ES = ParseError ("Buildlog.txt")
Print ("Errors:" + str (len (es)))
For E in es:
Print (e)
Simply parse Visual Studio's Buildlog: (sometimes log files are too long, but we just care about warning and error, through which you can get all the warning and error lines directly.