[bitbake-devel] bitbake: Ensure manually created loggers have the once filter

Message ID 20220217165853.69695-1-JPEWhacker@gmail.com
State New
Headers show
Series [bitbake-devel] bitbake: Ensure manually created loggers have the once filter | expand

Commit Message

Joshua Watt Feb. 17, 2022, 4:58 p.m. UTC
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

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
 bitbake/lib/bb/msg.py | 1 +
 1 file changed, 1 insertion(+)


diff --git a/bitbake/lib/bb/msg.py b/bitbake/lib/bb/msg.py
index 512ec1f5c1..c95a874beb 100644
--- a/bitbake/lib/bb/msg.py
+++ b/bitbake/lib/bb/msg.py
@@ -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()):