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 5ffe89eae3..2cac074a05 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) |
