Download:
child 33:575262e0eacb
parent 31:edd83c4dc2f0
32:1a20eb26c5df
Anton Shestakov <engored@ya.ru>, Thu, 28 May 2015 21:04:38 +0800
bench: logging format with date and auto width for counters

1 файлов изменено, 3 вставок(+), 2 удалений(-) [+]
bench.py file | annotate | diff | comparison | revisions
--- a/bench.py Thu May 28 20:41:24 2015 +0800
+++ b/bench.py Thu May 28 21:04:38 2015 +0800
@@ -179,6 +179,7 @@
conn = sqlite3.connect(DBPATH)
makeclean()
nodes = getnodes(revsets)
+ numwidth = len(str(len(nodes)))
for i, node in enumerate(nodes, 1):
madelocal = False
@@ -198,7 +199,7 @@
madelocal = True
time = test(mark, dropcache=not cache)
- logging.info('%05d/%05d %s %s %s', i, len(nodes), node, mark, time)
+ logging.info('%0*d/%0*d %s %s %s', numwidth, i, numwidth, len(nodes), node, mark, time)
if time is None:
continue
@@ -250,6 +251,6 @@
if __name__ == '__main__':
- logging.getLogger().setLevel(logging.INFO)
+ logging.basicConfig(format='%(levelname).1s %(asctime)s %(message)s', level=logging.INFO)
args = parser.parse_args()
main(args)