Skip to contentSkip to conversation

bitbake: Ensure manually created loggers have the once filter

PATCH New Joshua Watt 1 participant 1 message Feb 17, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 bitbake: Ensure manually created loggers have the once filter

Loggers created with a logging configuration file automatically get the once filter applied to ensure that warnonce()/erroronce() only appear a single time. The same filter needs to also be added to bb.msg.logger_create() to ensure that manually created loggers have the same behavior

---
 bitbake/lib/bb/msg.py | 1 +
 1 file changed, 1 insertion(+)
bitbake/lib/bb/msg.py +1 -0
index 512ec1f5c1..c95a874beb 100644
@@ -229,6 +229,7 @@ def logger_create(name, output=sys.stderr, level=logging.INFO, preserve_handlers
     """Standalone logger creation function"""
     logger = logging.getLogger(name)
     console = logging.StreamHandler(output)
+    console.addFilter(bb.msg.LogFilterShowOnce())
     format = bb.msg.BBLogFormatter("%(levelname)s: %(message)s")
     if color == 'always' or (color == 'auto' and output.isatty()):
         format.enable_color()
Signature · 1 line
2.33.0