summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSeth Vidal <skvidal@fedoraproject.org>2013-07-04 15:49:10 -0400
committerSeth Vidal <skvidal@fedoraproject.org>2013-07-04 15:49:10 -0400
commit022083d7b97b8e08ea1fba2ddb67c7d735e08f0b (patch)
treec7f229ee1fd1a0c24b587b84e8c0abd5601896c1
parent88caed356a960bc10623306fdd5b2e6c94590dbb (diff)
downloadansible-022083d7b97b8e08ea1fba2ddb67c7d735e08f0b.tar.gz
ansible-022083d7b97b8e08ea1fba2ddb67c7d735e08f0b.tar.xz
ansible-022083d7b97b8e08ea1fba2ddb67c7d735e08f0b.zip
sortable, I think
-rwxr-xr-xscripts/logview23
1 files changed, 14 insertions, 9 deletions
diff --git a/scripts/logview b/scripts/logview
index 02a9b592e..3bb610c31 100755
--- a/scripts/logview
+++ b/scripts/logview
@@ -54,26 +54,31 @@ def search_logs(opts, logfiles):
things = line.split('\t')
if things[2] in opts.search_terms or 'ANY' in opts.search_terms:
slurp = json.loads(things[4])
+ if opts.profile:
+ st = slurp.get('task_start', 0)
+ end = slurp.get('task_end', 0)
+ if st and end:
+ dur = '%.2f' % (float(end) - float(st))
+ else:
+ dur = "Unknown"
+
msg += '%s\t%s\t%s\t%s\t%s\t%s' % (timestamp, hostname, things[0], things[1], things[2], things[3])
if not opts.verbose:
if type(slurp) == dict:
for term in ['task_userid', 'cmd']:
if term in slurp:
msg += '\t%s:%s' % (term, slurp.get(term, None))
+ if opts.profile:
+ msg += '\t%s:%s' % ('dur', dur)
+
msg += '\n'
else:
msg += '\n'
msg += json.dumps(slurp, indent=4)
msg += '\n'
- if opts.profile:
- st = slurp.get('task_start', 0)
- end = slurp.get('task_end', 0)
- if st and end:
- dur = '%.2f' % (float(end) - float(st))
- else:
- dur = "Unknown"
- msg += ' Duration: %s sec\n' % dur
-
+ if opts.profile:
+ msg += 'Duration: %s\n' % dur
+
return msg