[bitbake-devel,v2,1/1] lib/bb/codeparser: ensure BufferedLogger respects target logging level

Submitted by Paul Eggleton on March 28, 2017, 8:41 p.m. | Patch ID: 138557


Message ID 1c04460ad9b11930f74afcc4d1aa88e800056580.1490733586.git.paul.eggleton@linux.intel.com
State New
Headers show

Commit Message

Paul Eggleton March 28, 2017, 8:41 p.m.
BufferedLogger was sending log records to the target logger without
checking if the logger is enabled for the level of the record - and
handle() doesn't check this either (it's normally checked earlier when
the relevant log function is called e.g. logger.debug()), leading for
example to debug messages from codeparser getting printed when the log
level for the main BitBake logger was set to logging.WARNING.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
 lib/bb/codeparser.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/lib/bb/codeparser.py b/lib/bb/codeparser.py
index 5d2d440..89d24ab 100644
--- a/lib/bb/codeparser.py
+++ b/lib/bb/codeparser.py
@@ -186,7 +186,8 @@  class BufferedLogger(Logger):
     def flush(self):
         for record in self.buffer:
-            self.target.handle(record)
+            if self.target.isEnabledFor(record.levelno):
+                self.target.handle(record)
         self.buffer = []
 class PythonParser():