From cbdc81456b68963f7ee5c72c16beaa244776898d Mon Sep 17 00:00:00 2001 From: Seth Bollinger Date: Thu, 15 Nov 2012 19:29:40 -0600 Subject: 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 Signed-off-by: Richard Purdie --- bitbake/lib/bb/ui/knotty.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'bitbake/lib/bb/ui/knotty.py') 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): helper = uihelper.BBUIHelper() console = logging.StreamHandler(sys.stdout) - format = bb.msg.BBLogFormatter("%(levelname)s: %(message)s") + format_str = "%(levelname)s: %(message)s" + format = bb.msg.BBLogFormatter(format_str) + if interactive: + format.enable_color() bb.msg.addDefaultlogFilter(console) console.setFormatter(format) logger.addHandler(console) if consolelogfile: bb.utils.mkdirhier(os.path.dirname(consolelogfile)) + format = bb.msg.BBLogFormatter(format_str) consolelog = logging.FileHandler(consolelogfile) bb.msg.addDefaultlogFilter(consolelog) consolelog.setFormatter(format) -- cgit v1.2.3-54-g00ecf