Skip to content

Instantly share code, notes, and snippets.

@srid
Created June 27, 2012 20:28
Show Gist options
  • Save srid/3006688 to your computer and use it in GitHub Desktop.
Save srid/3006688 to your computer and use it in GitHub Desktop.
diff --git a/kato/python/kato/tail.py b/kato/python/kato/tail.py
index aa22602..053c46f 100644
--- a/kato/python/kato/tail.py
+++ b/kato/python/kato/tail.py
@@ -112,6 +112,9 @@ class LogFormatter:
Appropriate highlight is applied based on the semantic of log
message levels.
"""
+ # WORKAROUND a bug in snow leopard's terminal.app causing `kato tail` to blink
+ use_color = 'xterm' in os.getenv('TERM', '')
+
colored_name = fg256(self.colormap[name], name)
kind = None
@@ -138,13 +141,13 @@ class LogFormatter:
elif 'WARN' in line:
kind = 'warning'
- if kind == 'error':
+ if kind == 'error' and use_color:
line = highlight256('red', line)
- elif kind == 'warning':
+ elif kind == 'warning' and use_color:
line = highlight256('orange', line)
return '{0:{1}} --> {2}'.format(
- colored_name, self.name_width, line)
+ colored_name if use_color else name, self.name_width, line)
def tail_and_show(procs, filter_noise):
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment