log-search: Show duration.

This commit is contained in:
Alex Vandiver 2022-04-28 18:07:41 -07:00 committed by Alex Vandiver
parent 056895cc33
commit 65b99377d2
1 changed files with 7 additions and 0 deletions

View File

@ -281,6 +281,12 @@ def print_line(
ts = match["date"] + ":" + match["time"] ts = match["date"] + ":" + match["time"]
else: else:
ts = match["time"] ts = match["time"]
if match["duration"].endswith("ms"):
duration = match["duration"][:-2]
else:
duration = str(int(float(match["duration"][:-1]) * 1000))
code = int(match["code"]) code = int(match["code"])
indicator = " " indicator = " "
color = "" color = ""
@ -312,6 +318,7 @@ def print_line(
parts = [ parts = [
ts, ts,
f"{duration:>5}ms",
f"{user_id:7}" if not args.nginx and filter_type != FilterType.USER_ID else None, f"{user_id:7}" if not args.nginx and filter_type != FilterType.USER_ID else None,
f"{match['ip']:39}" if filter_type != FilterType.CLIENT_IP else None, f"{match['ip']:39}" if filter_type != FilterType.CLIENT_IP else None,
indicator + match["code"], indicator + match["code"],