diff options
-rw-r--r-- | bitbake/lib/bb/event.py | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/bitbake/lib/bb/event.py b/bitbake/lib/bb/event.py index 1f3200e196..42745e241e 100644 --- a/bitbake/lib/bb/event.py +++ b/bitbake/lib/bb/event.py | |||
@@ -119,21 +119,28 @@ def print_ui_queue(): | |||
119 | logger = logging.getLogger("BitBake") | 119 | logger = logging.getLogger("BitBake") |
120 | if not _uiready: | 120 | if not _uiready: |
121 | from bb.msg import BBLogFormatter | 121 | from bb.msg import BBLogFormatter |
122 | console = logging.StreamHandler(sys.stdout) | 122 | stdout = logging.StreamHandler(sys.stdout) |
123 | console.setFormatter(BBLogFormatter("%(levelname)s: %(message)s")) | 123 | stderr = logging.StreamHandler(sys.stderr) |
124 | logger.handlers = [console] | 124 | formatter = BBLogFormatter("%(levelname)s: %(message)s") |
125 | stdout.setFormatter(formatter) | ||
126 | stderr.setFormatter(formatter) | ||
125 | 127 | ||
126 | # First check to see if we have any proper messages | 128 | # First check to see if we have any proper messages |
127 | msgprint = False | 129 | msgprint = False |
128 | for event in ui_queue: | 130 | for event in ui_queue: |
129 | if isinstance(event, logging.LogRecord): | 131 | if isinstance(event, logging.LogRecord): |
130 | if event.levelno > logging.DEBUG: | 132 | if event.levelno > logging.DEBUG: |
133 | if event.levelno >= logging.WARNING: | ||
134 | logger.handlers = [stderr] | ||
135 | else: | ||
136 | logger.handlers = [stdout] | ||
131 | logger.handle(event) | 137 | logger.handle(event) |
132 | msgprint = True | 138 | msgprint = True |
133 | if msgprint: | 139 | if msgprint: |
134 | return | 140 | return |
135 | 141 | ||
136 | # Nope, so just print all of the messages we have (including debug messages) | 142 | # Nope, so just print all of the messages we have (including debug messages) |
143 | logger.handlers = [stdout] | ||
137 | for event in ui_queue: | 144 | for event in ui_queue: |
138 | if isinstance(event, logging.LogRecord): | 145 | if isinstance(event, logging.LogRecord): |
139 | logger.handle(event) | 146 | logger.handle(event) |