forked from evhub/ripple-git-bot
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathlogger.py
31 lines (27 loc) · 796 Bytes
/
logger.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/usr/bin/python
# The Log Processing Function:
def logproc(logs):
"""Correctly Orders Raw Unordered Heroku Logs Based On Their Number."""
logs = str(logs)
lines = []
for line in logs.split("\n"):
if ": " in line:
line = line.split(": ", 1)[1]
if ". " in line:
line = line.split(". ", 1)
else:
line = ("0", line)
line = (int(line[0]), line[1])
lines.append(line)
lines.sort()
out = ""
for num, line in lines:
out += str(num)+". "+line+"\n"
return out[:-1]
# Running Log Processing:
if __name__ == "__main__":
inputstring = True
while inputstring:
if True != inputstring:
print(logproc(inputstring))
inputstring = raw_input("Paste Logs: ")