diff options
author | Scott Rifenbark <scott.m.rifenbark@intel.com> | 2011-08-29 05:36:03 -0700 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2011-08-30 17:27:37 +0100 |
commit | d67201e6003ad2be8ebcd9aaca9c8212cf8ca007 (patch) | |
tree | bbdc387f05a523b633e61ec47690daec59195db8 /documentation | |
parent | ba3069c9c68783f018543064d12d53fa4b6988c4 (diff) | |
download | ast2050-yocto-poky-d67201e6003ad2be8ebcd9aaca9c8212cf8ca007.zip ast2050-yocto-poky-d67201e6003ad2be8ebcd9aaca9c8212cf8ca007.tar.gz |
documentation/poky-ref-manual/usingpoky.xml: Updated logging mechanism
Per Darren's feedback on this new section I updated changes based
on his comments.
(From yocto-docs rev: a5bbba42ec0da5b2f83f7a64ac8eef466e9c89b3)
Signed-off-by: Scott Rifenbark <scott.m.rifenbark@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'documentation')
-rw-r--r-- | documentation/poky-ref-manual/usingpoky.xml | 44 |
1 files changed, 23 insertions, 21 deletions
diff --git a/documentation/poky-ref-manual/usingpoky.xml b/documentation/poky-ref-manual/usingpoky.xml index b36526e..976f7f4 100644 --- a/documentation/poky-ref-manual/usingpoky.xml +++ b/documentation/poky-ref-manual/usingpoky.xml @@ -375,20 +375,28 @@ <para> Best practices exist while writing recipes that both log build progress and act on build conditions such as warnings and errors. - Depending whether you are creating recipes using Bash or Python, the mechanism - differs: + Both Python and Bash language bindings exist for the logging mechanism: <itemizedlist> - <listitem><para><emphasis>Python:</emphasis> For Python functions BitBake + <listitem><para><emphasis>Python:</emphasis> For Python functions, BitBake supports several loglevels: <filename>bb.fatal</filename>, <filename>bb.error</filename>, <filename>bb.warn</filename>, <filename>bb.note</filename>, <filename>bb.plain</filename>, and <filename>bb.debug</filename>.</para></listitem> - <listitem><para><emphasis>Bash:</emphasis> For Bash functions you use the - <filename>echo</filename> command and prepend a diagnostic string that includes - the loglevel followed by a colon character</para></listitem> + <listitem><para><emphasis>Bash:</emphasis> For Bash functions, the same set + of loglevels exist and are accessed with a similar syntax: + <filename>bb.fatal</filename>, <filename>bb.error</filename>, + <filename>bb.warn</filename>, <filename>bb.note</filename>, + <filename>bb.plain</filename>, and <filename>bb.debug</filename>.</para></listitem> </itemizedlist> </para> + <para> + For guidance on <filename>echo</filename> how logging is handled + in both Python and Bash recipes, see the + <filename>logging.bbclass</filename> file in the + <filename>meta/classes</filename> directory of the Yocto Project files. + </para> + <section id='logging-with-python'> <title>Logging With Python</title> <para> @@ -426,14 +434,8 @@ <para> When creating recipes using Bash and inserting code that handles build logs you have the same goals - informative with minimal console output. - Use the <filename>echo</filename> command and prepend the diagnostic string - with the appropriate loglevel floowed by the colon character. - </para> - - <para> - For guidance on <filename>echo</filename> usage in Bash recipes, see the - <filename>logging.bbclass</filename> file in the - <filename>meta/classes</filename> directory of the Yocto Project files. + The syntax you use for recipes written in Bash is similar to that of + recipes written in Python described in the previous section. </para> <para> @@ -441,21 +443,21 @@ The code logs the progress of the <filename>do_my_function</filename> function. <literallayout class='monospaced'> do_my_function() { - echo "Running do_my_function()" + bbdebug 2 "Running do_my_function" if [ exceptional_condition ]; then - echo "NOTE: hit exceptional_condition" + bbnote "Hit exceptional_condition" fi - echo "DEBUG: got to point xyz" + bbdebug 2 "Got to point xyz" if [ warning_trigger ]; then - echo "WARNING: detected warning_trigger, this might cause a plroblem later." + warn "Detected warning_trigger, this might cause a problem later." fi if [ recoverable_error ]; then - echo "ERROR: hit recoverable_error, correcting" + error "Hit recoverable_error, correcting" fi if [ fatal_error ]; then - echo "FATAL: fatal_error detected" + fatal "fatal_error detected" fi - echo "Completed do_my_function" + debug 2 "Completed do_my_function" } </literallayout> </para> |