bitbake: lib/bb: format and improve logging docstrings

Format the docstrings of the utils modules to be automatically
documented with the autodoc Sphinx extensions.

(Bitbake rev: 4963bfc6045ad1f49e721edd97766dab1e2d1edc)

Signed-off-by: Antonin Godard <antonin.godard@bootlin.com>
Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Antonin Godard
2025-04-18 17:15:26 +02:00
committed by Richard Purdie
parent 8c24921ba6
commit 1215042fa7

View File

@@ -129,9 +129,25 @@ sys.modules['bb.fetch'] = sys.modules['bb.fetch2']
# Messaging convenience functions
def plain(*args):
"""
Prints a message at "plain" level (higher level than a ``bb.note()``).
Arguments:
- ``args``: one or more strings to print.
"""
mainlogger.plain(''.join(args))
def debug(lvl, *args):
"""
Prints a debug message.
Arguments:
- ``lvl``: debug level. Higher value increases the debug level
(determined by ``bitbake -D``).
- ``args``: one or more strings to print.
"""
if isinstance(lvl, str):
mainlogger.warning("Passed invalid debug level '%s' to bb.debug", lvl)
args = (lvl,) + args
@@ -139,33 +155,81 @@ def debug(lvl, *args):
mainlogger.bbdebug(lvl, ''.join(args))
def note(*args):
"""
Prints a message at "note" level.
Arguments:
- ``args``: one or more strings to print.
"""
mainlogger.info(''.join(args))
#
# A higher prioity note which will show on the console but isn't a warning
#
# Something is happening the user should be aware of but they probably did
# something to make it happen
#
def verbnote(*args):
"""
A higher priority note which will show on the console but isn't a warning.
Use in contexts when something is happening the user should be aware of but
they probably did something to make it happen.
Arguments:
- ``args``: one or more strings to print.
"""
mainlogger.verbnote(''.join(args))
#
# Warnings - things the user likely needs to pay attention to and fix
#
def warn(*args):
"""
Prints a warning message.
Arguments:
- ``args``: one or more strings to print.
"""
mainlogger.warning(''.join(args))
def warnonce(*args):
"""
Prints a warning message like ``bb.warn()``, but only prints the message
once.
Arguments:
- ``args``: one or more strings to print.
"""
mainlogger.warnonce(''.join(args))
def error(*args, **kwargs):
"""
Prints an error message.
Arguments:
- ``args``: one or more strings to print.
"""
mainlogger.error(''.join(args), extra=kwargs)
def erroronce(*args):
"""
Prints an error message like ``bb.error()``, but only prints the message
once.
Arguments:
- ``args``: one or more strings to print.
"""
mainlogger.erroronce(''.join(args))
def fatal(*args, **kwargs):
"""
Prints an error message and stops the BitBake execution.
Arguments:
- ``args``: one or more strings to print.
"""
mainlogger.critical(''.join(args), extra=kwargs)
raise BBHandledException()