From aae4c2a629d5314a1ccf17e87827adb080cbbe53 Mon Sep 17 00:00:00 2001 From: Scott Rifenbark Date: Sat, 16 Jul 2016 12:51:53 -0700 Subject: [PATCH] ref-manual: Updated the "Recipe Logging Mechanisms" section Fixes [YOCTO #9950] Added more detail on the functions for logging. (From yocto-docs rev: b7ed4d84ae5221765201fe661af3741fb01da738) Signed-off-by: Scott Rifenbark Signed-off-by: Richard Purdie --- documentation/ref-manual/usingpoky.xml | 66 +++++++++++++++++++++----- 1 file changed, 53 insertions(+), 13 deletions(-) diff --git a/documentation/ref-manual/usingpoky.xml b/documentation/ref-manual/usingpoky.xml index 3a6b5a1a85..f94e3a79ff 100644 --- a/documentation/ref-manual/usingpoky.xml +++ b/documentation/ref-manual/usingpoky.xml @@ -356,23 +356,63 @@
Recipe Logging Mechanisms - Best practices exist while writing recipes that both log build progress and - act on build conditions such as warnings and errors. - Both Python and Bash language bindings exist for the logging mechanism: + Best practices exist while writing recipes that both log build + progress and act on build conditions such as warnings and errors. + For Python functions, the following logging functions exist. + All of these functions log to + ${T}/log.do_task, + and can also log to standard output (stdout) with the right + settings: - Python: For Python functions, BitBake - supports several loglevels: bb.fatal, - bb.error, bb.warn, - bb.note, bb.plain, - and bb.debug. - Bash: For Bash functions, the same set - of loglevels exist and are accessed with a similar syntax: - bbfatal, bberror, - bbwarn, bbnote, - bbplain, and bbdebug. + + bb.plain(msg): + Writes msg as is to the log while + also logging to stdout. + + + bb.note(msg): + Writes "NOTE: msg" to the log. + Also logs to stdout if BitBake is called with "-v". + + + bb.debug(levelmsg): + Writes "DEBUG: msg" to the log. + Also logs to stdout if the log level is greater than or + equal to level. + See the + "-D" + option in the BitBake User Manual for more information. + + + bb.warn(msg): + Writes "WARNING: msg" to the log + while also logging to stdout. + + + bb.error(msg): + Writes "ERROR: msg" to the log + while also logging to stdout. + + Calling this function does not cause the task to fail. + + + + bb.fatal(msg): + This logging function is similar to + bb.error(msg) + but also causes the calling task to fail. + + + The same logging functions are also available in shell functions, + under the names + bbplain, bbnote, + bbdebug, bbwarn, + bberror, and bbfatal. + + For guidance on how logging is handled in both Python and Bash recipes, see the logging.bbclass file in the