mirror of
https://git.yoctoproject.org/poky
synced 2026-06-02 01:19:52 +00:00
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:
committed by
Richard Purdie
parent
8c24921ba6
commit
1215042fa7
@@ -129,9 +129,25 @@ sys.modules['bb.fetch'] = sys.modules['bb.fetch2']
|
|||||||
|
|
||||||
# Messaging convenience functions
|
# Messaging convenience functions
|
||||||
def plain(*args):
|
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))
|
mainlogger.plain(''.join(args))
|
||||||
|
|
||||||
def debug(lvl, *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):
|
if isinstance(lvl, str):
|
||||||
mainlogger.warning("Passed invalid debug level '%s' to bb.debug", lvl)
|
mainlogger.warning("Passed invalid debug level '%s' to bb.debug", lvl)
|
||||||
args = (lvl,) + args
|
args = (lvl,) + args
|
||||||
@@ -139,33 +155,81 @@ def debug(lvl, *args):
|
|||||||
mainlogger.bbdebug(lvl, ''.join(args))
|
mainlogger.bbdebug(lvl, ''.join(args))
|
||||||
|
|
||||||
def note(*args):
|
def note(*args):
|
||||||
|
"""
|
||||||
|
Prints a message at "note" level.
|
||||||
|
|
||||||
|
Arguments:
|
||||||
|
|
||||||
|
- ``args``: one or more strings to print.
|
||||||
|
"""
|
||||||
mainlogger.info(''.join(args))
|
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):
|
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))
|
mainlogger.verbnote(''.join(args))
|
||||||
|
|
||||||
#
|
#
|
||||||
# Warnings - things the user likely needs to pay attention to and fix
|
# Warnings - things the user likely needs to pay attention to and fix
|
||||||
#
|
#
|
||||||
def warn(*args):
|
def warn(*args):
|
||||||
|
"""
|
||||||
|
Prints a warning message.
|
||||||
|
|
||||||
|
Arguments:
|
||||||
|
|
||||||
|
- ``args``: one or more strings to print.
|
||||||
|
"""
|
||||||
mainlogger.warning(''.join(args))
|
mainlogger.warning(''.join(args))
|
||||||
|
|
||||||
def warnonce(*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))
|
mainlogger.warnonce(''.join(args))
|
||||||
|
|
||||||
def error(*args, **kwargs):
|
def error(*args, **kwargs):
|
||||||
|
"""
|
||||||
|
Prints an error message.
|
||||||
|
|
||||||
|
Arguments:
|
||||||
|
|
||||||
|
- ``args``: one or more strings to print.
|
||||||
|
"""
|
||||||
mainlogger.error(''.join(args), extra=kwargs)
|
mainlogger.error(''.join(args), extra=kwargs)
|
||||||
|
|
||||||
def erroronce(*args):
|
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))
|
mainlogger.erroronce(''.join(args))
|
||||||
|
|
||||||
def fatal(*args, **kwargs):
|
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)
|
mainlogger.critical(''.join(args), extra=kwargs)
|
||||||
raise BBHandledException()
|
raise BBHandledException()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user