diff options
author | Seth Bollinger <seth.boll@gmail.com> | 2012-11-15 19:29:40 -0600 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2012-11-20 15:31:57 +0000 |
commit | cbdc81456b68963f7ee5c72c16beaa244776898d (patch) | |
tree | 86b85afaeb93077f3b2ae2c9bc944d0504f061d8 /bitbake/lib/bb/ui | |
parent | e3bda7f986ca509a530b7b17417ce91e19c6c654 (diff) | |
download | poky-cbdc81456b68963f7ee5c72c16beaa244776898d.tar.gz |
bitbake: knotty: Colorize knotty interactive console output
Add bold color output to log level name and standard color output to log msg
when bitbake is run from an iteractive console. Color output is only
enabled
if the terminal supports color.
Used Jason Wessel's recommendation for transparency on verbose, note and
plain.
(Bitbake rev: 2734240da2cc150f811129a6adf6eb4b2161b204)
Signed-off-by: Seth Bollinger <seth.boll@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/ui')
-rw-r--r-- | bitbake/lib/bb/ui/knotty.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/bitbake/lib/bb/ui/knotty.py b/bitbake/lib/bb/ui/knotty.py index 77ec7302a7..a63d8b120e 100644 --- a/bitbake/lib/bb/ui/knotty.py +++ b/bitbake/lib/bb/ui/knotty.py | |||
@@ -238,12 +238,16 @@ def main(server, eventHandler, tf = TerminalFilter): | |||
238 | helper = uihelper.BBUIHelper() | 238 | helper = uihelper.BBUIHelper() |
239 | 239 | ||
240 | console = logging.StreamHandler(sys.stdout) | 240 | console = logging.StreamHandler(sys.stdout) |
241 | format = bb.msg.BBLogFormatter("%(levelname)s: %(message)s") | 241 | format_str = "%(levelname)s: %(message)s" |
242 | format = bb.msg.BBLogFormatter(format_str) | ||
243 | if interactive: | ||
244 | format.enable_color() | ||
242 | bb.msg.addDefaultlogFilter(console) | 245 | bb.msg.addDefaultlogFilter(console) |
243 | console.setFormatter(format) | 246 | console.setFormatter(format) |
244 | logger.addHandler(console) | 247 | logger.addHandler(console) |
245 | if consolelogfile: | 248 | if consolelogfile: |
246 | bb.utils.mkdirhier(os.path.dirname(consolelogfile)) | 249 | bb.utils.mkdirhier(os.path.dirname(consolelogfile)) |
250 | format = bb.msg.BBLogFormatter(format_str) | ||
247 | consolelog = logging.FileHandler(consolelogfile) | 251 | consolelog = logging.FileHandler(consolelogfile) |
248 | bb.msg.addDefaultlogFilter(consolelog) | 252 | bb.msg.addDefaultlogFilter(consolelog) |
249 | consolelog.setFormatter(format) | 253 | consolelog.setFormatter(format) |