summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEd Bartosh <ed.bartosh@linux.intel.com>2016-09-08 11:02:33 (GMT)
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-11-08 23:47:14 (GMT)
commit2de121703d11809d02815e6434674c7ec5e5704c (patch)
tree3e7450555fd7e18dc45aa7822d5ec1b5ebc33c1d
parent8a12e713f9306ae45fa27cbc1127849d03101811 (diff)
downloadpoky-2de121703d11809d02815e6434674c7ec5e5704c.tar.gz
bitbake: event.py: output errors and warnings to stderr
All logging messages are printed on stdout when processing UI event queue. This makes it impossible to distinguish between errors and normal bitbake output. Output to stderror or stdout depending on log level should fix this. (Bitbake rev: c4029c4f00197804511fc71e1190d34eb120212a) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--bitbake/lib/bb/event.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/bitbake/lib/bb/event.py b/bitbake/lib/bb/event.py
index 5ffe89e..2cac074 100644
--- a/bitbake/lib/bb/event.py
+++ b/bitbake/lib/bb/event.py
@@ -117,21 +117,28 @@ def print_ui_queue():
117 logger = logging.getLogger("BitBake") 117 logger = logging.getLogger("BitBake")
118 if not _uiready: 118 if not _uiready:
119 from bb.msg import BBLogFormatter 119 from bb.msg import BBLogFormatter
120 console = logging.StreamHandler(sys.stdout) 120 stdout = logging.StreamHandler(sys.stdout)
121 console.setFormatter(BBLogFormatter("%(levelname)s: %(message)s")) 121 stderr = logging.StreamHandler(sys.stderr)
122 logger.handlers = [console] 122 formatter = BBLogFormatter("%(levelname)s: %(message)s")
123 stdout.setFormatter(formatter)
124 stderr.setFormatter(formatter)
123 125
124 # First check to see if we have any proper messages 126 # First check to see if we have any proper messages
125 msgprint = False 127 msgprint = False
126 for event in ui_queue: 128 for event in ui_queue:
127 if isinstance(event, logging.LogRecord): 129 if isinstance(event, logging.LogRecord):
128 if event.levelno > logging.DEBUG: 130 if event.levelno > logging.DEBUG:
131 if event.levelno >= logging.WARNING:
132 logger.handlers = [stderr]
133 else:
134 logger.handlers = [stdout]
129 logger.handle(event) 135 logger.handle(event)
130 msgprint = True 136 msgprint = True
131 if msgprint: 137 if msgprint:
132 return 138 return
133 139
134 # Nope, so just print all of the messages we have (including debug messages) 140 # Nope, so just print all of the messages we have (including debug messages)
141 logger.handlers = [stdout]
135 for event in ui_queue: 142 for event in ui_queue:
136 if isinstance(event, logging.LogRecord): 143 if isinstance(event, logging.LogRecord):
137 logger.handle(event) 144 logger.handle(event)