From caadd39cc21d2b8033e0f2fcf1a8b7dd2e07d410 Mon Sep 17 00:00:00 2001 From: Sasha Levitskiy Date: Thu, 29 May 2014 11:16:22 -0700 Subject: [PATCH] - Fixed tag matching for tags containing '(' - Priority is matched to known priorities - Pid is cleaned up on match - Pid display is more compact and right aligned - Tag display is a bit wider - Removed redundant strip --- coloredlogcat.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/coloredlogcat.py b/coloredlogcat.py index 56c7571..6e11507 100755 --- a/coloredlogcat.py +++ b/coloredlogcat.py @@ -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 @@ -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+)") @@ -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)))