Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "fix(dev): parse-controller-logs tool" #1102

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions parse-controller-logs
Original file line number Diff line number Diff line change
Expand Up @@ -22,28 +22,28 @@ def col_wrap(stri, collev):
filters = {sp[0]: sp[1] for sp in [arg.split(":", 1) for arg in sys.argv[1:]]}

def print_message(line):
ts = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(int(line["ts"])))
ts = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(int(js["ts"])))

string = ""
if 'level' in line:
collev = levels.get(line['level'], levels["info"])
elif line.get('diff') != None:
if 'level' in js:
collev = levels[js['level']]
elif js.get('diff') != None:
collev = levels['diff']
else:
collev = cancel_colour

string += collev

app = "[%s]" % line["app"] if "app" in line else ""
env = "[%s]" % line["env"] if "env" in line else ""
app = "[%s]" % js["app"] if "app" in js else ""
env = "[%s]" % js["env"] if "env" in js else ""

string += f'[{ts}] {line["level"].upper()} {line.get("ctrl", "").upper()} {app or env} {line["msg"]} '
string += f'[{ts}] {js["level"].upper()} {js.get("ctrl", "").upper()} {app or env} {js["msg"]} '
rms = ["msg", "ts", "level", "ctrl", "logger"]
for key in rms:
if key in line:
del(line[key])
s_key = sorted(line.keys())
string += " ".join([f"{col_wrap(f"{k}:", collev)}{line[k]}" for k in s_key])
if key in js:
del(js[key])
s_key = sorted(js.keys())
string += " ".join([f"{col_wrap(k, collev)}:{js[k]}" for k in s_key])
string += cancel_colour
print(string)

Expand Down
Loading