Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save garethstockwell/2894361 to your computer and use it in GitHub Desktop.
Save garethstockwell/2894361 to your computer and use it in GitHub Desktop.
Add support for missing tag types to coloredlogcat.py
commit bcf3d2c3aeb72f8d295af6d19cfcdaefeb04dd18
Author: Gareth Stockwell <none>
AuthorDate: Fri Jun 8 09:02:18 2012 +0100
Commit: Gareth Stockwell <none>
CommitDate: Fri Jun 8 09:02:18 2012 +0100
Add missing tag types
diff --git a/coloredlogcat.py b/coloredlogcat.py
index d46dbf6..666231f 100644
--- a/coloredlogcat.py
+++ b/coloredlogcat.py
@@ -92,6 +92,8 @@ TAGTYPES = {
"I": "%s%s%s " % (format(fg=BLACK, bg=GREEN), "I".center(TAGTYPE_WIDTH), format(reset=True)),
"W": "%s%s%s " % (format(fg=BLACK, bg=YELLOW), "W".center(TAGTYPE_WIDTH), format(reset=True)),
"E": "%s%s%s " % (format(fg=BLACK, bg=RED), "E".center(TAGTYPE_WIDTH), format(reset=True)),
+ "F": "%s%s%s " % (format(fg=RED, bg=BLACK), "F".center(TAGTYPE_WIDTH), format(reset=True)),
+ "S": "%s%s%s " % (format(fg=BLACK, bg=WHITE), "S".center(TAGTYPE_WIDTH), format(reset=True)),
}
retag = re.compile("^([A-Z])/([^\(]+)\(([^\)]+)\): (.*)$")
@@ -128,7 +130,9 @@ while True:
linebuf.write("%s%s %s" % (format(fg=color, dim=False), tag, format(reset=True)))
# write out tagtype colored edge
- if not tagtype in TAGTYPES: break
+ if not tagtype in TAGTYPES:
+ print >> sys.stderr, "ERROR: unmatched tag " + tagtype
+ break
linebuf.write(TAGTYPES[tagtype])
# insert line wrapping as needed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment