summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/__init__.py
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2022-02-16 09:46:46 -0600
committerRichard Purdie <richard.purdie@linuxfoundation.org>2022-02-17 17:51:03 +0000
commitdac63330e6879a0354449c8ad52f09a888d49d27 (patch)
tree5cbb15b2c582ace3677836bdf0614e614c853e24 /bitbake/lib/bb/__init__.py
parent2e20effe31a904c1aa0172291124ebdcf0889598 (diff)
downloadpoky-dac63330e6879a0354449c8ad52f09a888d49d27.tar.gz
bitbake: msg: Add bb.warnonce() and bb.erroronce() log methods
This adds a log level and logging function call to use it where the warning or error will only be displayed once, regardless of how many times the message is logged. This has to be done either in the cooker or on the UI side. I've opted for the UI side since display control is really a UI issue but it uses a common library filter function to enable it which can be reused elsewhere. The knotty message displayed as the build summary is tweaked to make sense when the numbers won't match since it will still count the number of times it was logged and this is probably helpful for debugging in some cases so I've deliberately left it that way. (Bitbake rev: 7bd40e3003a043e3cb7efc276681054b563b5e7b) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> Signed-off-by: Joshua Watt <JPEWhacker@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/__init__.py')
-rw-r--r--bitbake/lib/bb/__init__.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/bitbake/lib/bb/__init__.py b/bitbake/lib/bb/__init__.py
index e01b8d5256..269f65edce 100644
--- a/bitbake/lib/bb/__init__.py
+++ b/bitbake/lib/bb/__init__.py
@@ -71,6 +71,13 @@ class BBLoggerMixin(object):
71 def verbnote(self, msg, *args, **kwargs): 71 def verbnote(self, msg, *args, **kwargs):
72 return self.log(logging.INFO + 2, msg, *args, **kwargs) 72 return self.log(logging.INFO + 2, msg, *args, **kwargs)
73 73
74 def warnonce(self, msg, *args, **kwargs):
75 return self.log(logging.WARNING - 1, msg, *args, **kwargs)
76
77 def erroronce(self, msg, *args, **kwargs):
78 return self.log(logging.ERROR - 1, msg, *args, **kwargs)
79
80
74Logger = logging.getLoggerClass() 81Logger = logging.getLoggerClass()
75class BBLogger(Logger, BBLoggerMixin): 82class BBLogger(Logger, BBLoggerMixin):
76 def __init__(self, name, *args, **kwargs): 83 def __init__(self, name, *args, **kwargs):
@@ -157,9 +164,15 @@ def verbnote(*args):
157def warn(*args): 164def warn(*args):
158 mainlogger.warning(''.join(args)) 165 mainlogger.warning(''.join(args))
159 166
167def warnonce(*args):
168 mainlogger.warnonce(''.join(args))
169
160def error(*args, **kwargs): 170def error(*args, **kwargs):
161 mainlogger.error(''.join(args), extra=kwargs) 171 mainlogger.error(''.join(args), extra=kwargs)
162 172
173def erroronce(*args):
174 mainlogger.erroronce(''.join(args))
175
163def fatal(*args, **kwargs): 176def fatal(*args, **kwargs):
164 mainlogger.critical(''.join(args), extra=kwargs) 177 mainlogger.critical(''.join(args), extra=kwargs)
165 raise BBHandledException() 178 raise BBHandledException()