[oe-commits] [openembedded-core] 04/06: oe.scriptutils: also send WARNING to stderr

git at git.openembedded.org git at git.openembedded.org
Mon Mar 4 23:00:56 UTC 2019


This is an automated email from the git hooks/post-receive script.

rpurdie pushed a commit to branch master-next
in repository openembedded-core.

commit dbe6509579345e143532422ae92740b5ddbb7ea6
Author: Christopher Larson <chris_larson at mentor.com>
AuthorDate: Mon Mar 4 21:36:26 2019 +0000

    oe.scriptutils: also send WARNING to stderr
    
    stderr isn't just for errors, but anything out of band. It's highly unlikely
    that warning messages are anything but out of band, which makes scripting our
    tools more troublesome, since the script calling it has to filter out the
    warnings from stdout to get the real output.
    
    Signed-off-by: Christopher Larson <chris_larson at mentor.com>
    Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
 scripts/lib/scriptutils.py | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/scripts/lib/scriptutils.py b/scripts/lib/scriptutils.py
index c361d07..d1a5020 100644
--- a/scripts/lib/scriptutils.py
+++ b/scripts/lib/scriptutils.py
@@ -43,9 +43,11 @@ def logger_setup_filters(logger):
     import bb.msg
 
     console = logging.StreamHandler(sys.stdout)
+    bb.msg.addDefaultlogFilter(console)
     errconsole = logging.StreamHandler(sys.stderr)
-    bb.msg.addDefaultlogFilter(console, bb.msg.BBLogFilterStdOut)
-    bb.msg.addDefaultlogFilter(errconsole, bb.msg.BBLogFilterStdErr)
+    bb.msg.addDefaultlogFilter(errconsole)
+    console.addFilter(lambda r: r.levelno < logging.WARNING)
+    errconsole.addFilter(lambda r: r.levelno >= logging.WARNING)
     format_str = "%(levelname)s: %(message)s"
     console.setFormatter(bb.msg.BBLogFormatter(format_str))
     errconsole.setFormatter(bb.msg.BBLogFormatter(format_str))

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


More information about the Openembedded-commits mailing list