|
|
@ -101,15 +101,22 @@ def message(tag, msg, explanatory_text=None, do_newline=False): |
|
|
|
print '%s: %s' % (tag, msg) |
|
|
|
print '%s: %s' % (tag, msg) |
|
|
|
return |
|
|
|
return |
|
|
|
try: |
|
|
|
try: |
|
|
|
sys.stdout.write('%s%s%s\x1b[%d;%dm%s\x1b[0m: %s%s' % ( |
|
|
|
if sys.stdout.isatty(): |
|
|
|
_BEGINNING_OF_LINE, |
|
|
|
sys.stdout.write('%s%s%s\x1b[%d;%dm%s\x1b[0m: %s%s' % ( |
|
|
|
_CLEAR_LINE, |
|
|
|
_BEGINNING_OF_LINE, |
|
|
|
'\n%s' % explanatory_text if explanatory_text is not None else '', |
|
|
|
_CLEAR_LINE, |
|
|
|
_COLORS[_TAG_COLOR[tag]][1], |
|
|
|
'\n%s' % explanatory_text if explanatory_text is not None else '', |
|
|
|
_COLORS[_TAG_COLOR[tag]][0], |
|
|
|
_COLORS[_TAG_COLOR[tag]][1], |
|
|
|
tag, |
|
|
|
_COLORS[_TAG_COLOR[tag]][0], |
|
|
|
msg, |
|
|
|
tag, |
|
|
|
'\n' if do_newline or explanatory_text is not None else '')) |
|
|
|
msg, |
|
|
|
|
|
|
|
'\n' if do_newline or explanatory_text is not None else '')) |
|
|
|
|
|
|
|
else: |
|
|
|
|
|
|
|
sys.stdout.write('%s%s: %s%s' % ( |
|
|
|
|
|
|
|
'\n%s' % explanatory_text if explanatory_text is not None else '', |
|
|
|
|
|
|
|
tag, |
|
|
|
|
|
|
|
msg, |
|
|
|
|
|
|
|
'\n')) |
|
|
|
sys.stdout.flush() |
|
|
|
sys.stdout.flush() |
|
|
|
except: |
|
|
|
except: |
|
|
|
pass |
|
|
|
pass |
|
|
|