Skip to content
Open
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
11 changes: 5 additions & 6 deletions coloredlogcat.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@

# Width of various columns; set to -1 to hide
USER_WIDTH = 3
PROCESS_WIDTH = 8
TAG_WIDTH = 20
PROCESS_WIDTH = 5
TAG_WIDTH = 24
PRIORITY_WIDTH = 3

HEADER_SIZE = USER_WIDTH + PROCESS_WIDTH + TAG_WIDTH + PRIORITY_WIDTH + 4
Expand Down Expand Up @@ -111,7 +111,7 @@ def allocate_color(tag):
"F": "%s%s%s " % (format(fg=BLACK, bg=RED), "F".center(PRIORITY_WIDTH), format(reset=True)),
}

retag = re.compile("^([A-Z])/([^\(]+)\(([^\)]+)\): (.*)$")
retag = re.compile("^([VDIWEF])\/(.+)\(\s*(\d{1,5})\): (.+)$")
retime = re.compile("(?:(\d+)s)?([\d.]+)ms")
reproc = re.compile(r"^I/ActivityManager.*?: Start proc .*?: pid=(\d+) uid=(\d+)")

Expand Down Expand Up @@ -175,13 +175,12 @@ def millis_color(match):
else:
linebuf.write(" " * (USER_WIDTH + 1))

# center process info
# right-align process info
if PROCESS_WIDTH > 0:
process = process.strip().center(PROCESS_WIDTH)
process = process.rjust(PROCESS_WIDTH)
linebuf.write("%s%s%s " % (format(fg=BLACK, bg=BLACK, bright=True), process, format(reset=True)))

# right-align tag title and allocate color if needed
tag = tag.strip()
if tag in HIGHLIGHT:
tag = tag[-TAG_WIDTH:].rjust(TAG_WIDTH)
linebuf.write("%s%s%s " % (format(fg=BLACK, bg=WHITE, dim=False), tag, format(reset=True)))
Expand Down