From 45913cd580ae5b01aade79936f2c4720d29e5b7a Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Thu, 9 Jun 2016 13:38:00 +0200 Subject: pretty up the output and add a sample string Change-Id: I1c37b32e2127ba99b48b5ce3176e605f4e797475 --- bin/find-most-common-warn-messages.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'bin') diff --git a/bin/find-most-common-warn-messages.py b/bin/find-most-common-warn-messages.py index 3cbf2114041b..d89a8873fa4d 100755 --- a/bin/find-most-common-warn-messages.py +++ b/bin/find-most-common-warn-messages.py @@ -14,6 +14,7 @@ process = subprocess.Popen("find workdir -name '*.log' | xargs grep -h 'warn:' | shell=True, stdout=subprocess.PIPE, universal_newlines=True) messages = dict() # dict of sourceAndLine->count +sampleOfMessage = dict() # dict of sourceAndLine->string for line in process.stdout: line = line.strip() # a sample line is: @@ -24,12 +25,13 @@ for line in process.stdout: messages[sourceAndLine] = messages[sourceAndLine] + 1 else: messages[sourceAndLine] = 1 + sampleOfMessage[sourceAndLine] = tokens[6] tmplist = list() # set of tuple (count, sourceAndLine) for key, value in messages.iteritems(): tmplist.append([value,key]) for i in sorted(tmplist, key=lambda v: v[0]): - print i + print( "%6d %s %s" % (i[0], i[1], sampleOfMessage[i[1]]) ) -- cgit