[oe-commits] [bitbake] 01/04: event.py: output errors and warnings to stderr

git at git.openembedded.org git at git.openembedded.org
Tue Nov 8 23:48:11 UTC 2016


rpurdie pushed a commit to branch 1.30
in repository bitbake.

commit c4029c4f00197804511fc71e1190d34eb120212a
Author: Ed Bartosh <ed.bartosh at linux.intel.com>
AuthorDate: Thu Sep 8 14:02:33 2016 +0300

    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.
    
    Signed-off-by: Ed Bartosh <ed.bartosh at linux.intel.com>
    Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
 lib/bb/event.py | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/lib/bb/event.py b/lib/bb/event.py
index 5ffe89e..2cac074 100644
--- a/lib/bb/event.py
+++ b/lib/bb/event.py
@@ -117,21 +117,28 @@ def print_ui_queue():
     logger = logging.getLogger("BitBake")
     if not _uiready:
         from bb.msg import BBLogFormatter
-        console = logging.StreamHandler(sys.stdout)
-        console.setFormatter(BBLogFormatter("%(levelname)s: %(message)s"))
-        logger.handlers = [console]
+        stdout = logging.StreamHandler(sys.stdout)
+        stderr = logging.StreamHandler(sys.stderr)
+        formatter = BBLogFormatter("%(levelname)s: %(message)s")
+        stdout.setFormatter(formatter)
+        stderr.setFormatter(formatter)
 
         # First check to see if we have any proper messages
         msgprint = False
         for event in ui_queue:
             if isinstance(event, logging.LogRecord):
                 if event.levelno > logging.DEBUG:
+                    if event.levelno >= logging.WARNING:
+                        logger.handlers = [stderr]
+                    else:
+                        logger.handlers = [stdout]
                     logger.handle(event)
                     msgprint = True
         if msgprint:
             return
 
         # Nope, so just print all of the messages we have (including debug messages)
+        logger.handlers = [stdout]
         for event in ui_queue:
             if isinstance(event, logging.LogRecord):
                 logger.handle(event)

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list