summaryrefslogtreecommitdiffstats
path: root/documentation
diff options
context:
space:
mode:
authorScott Rifenbark <scott.m.rifenbark@intel.com>2011-08-29 05:36:03 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2011-08-30 17:27:37 +0100
commitd67201e6003ad2be8ebcd9aaca9c8212cf8ca007 (patch)
treebbdc387f05a523b633e61ec47690daec59195db8 /documentation
parentba3069c9c68783f018543064d12d53fa4b6988c4 (diff)
downloadpoky-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.xml44
1 files changed, 23 insertions, 21 deletions
diff --git a/documentation/poky-ref-manual/usingpoky.xml b/documentation/poky-ref-manual/usingpoky.xml
index b36526e919..976f7f4c11 100644
--- a/documentation/poky-ref-manual/usingpoky.xml
+++ b/documentation/poky-ref-manual/usingpoky.xml
@@ -375,20 +375,28 @@
375 <para> 375 <para>
376 Best practices exist while writing recipes that both log build progress and 376 Best practices exist while writing recipes that both log build progress and
377 act on build conditions such as warnings and errors. 377 act on build conditions such as warnings and errors.
378 Depending whether you are creating recipes using Bash or Python, the mechanism 378 Both Python and Bash language bindings exist for the logging mechanism:
379 differs:
380 <itemizedlist> 379 <itemizedlist>
381 <listitem><para><emphasis>Python:</emphasis> For Python functions BitBake 380 <listitem><para><emphasis>Python:</emphasis> For Python functions, BitBake
382 supports several loglevels: <filename>bb.fatal</filename>, 381 supports several loglevels: <filename>bb.fatal</filename>,
383 <filename>bb.error</filename>, <filename>bb.warn</filename>, 382 <filename>bb.error</filename>, <filename>bb.warn</filename>,
384 <filename>bb.note</filename>, <filename>bb.plain</filename>, 383 <filename>bb.note</filename>, <filename>bb.plain</filename>,
385 and <filename>bb.debug</filename>.</para></listitem> 384 and <filename>bb.debug</filename>.</para></listitem>
386 <listitem><para><emphasis>Bash:</emphasis> For Bash functions you use the 385 <listitem><para><emphasis>Bash:</emphasis> For Bash functions, the same set
387 <filename>echo</filename> command and prepend a diagnostic string that includes 386 of loglevels exist and are accessed with a similar syntax:
388 the loglevel followed by a colon character</para></listitem> 387 <filename>bb.fatal</filename>, <filename>bb.error</filename>,
388 <filename>bb.warn</filename>, <filename>bb.note</filename>,
389 <filename>bb.plain</filename>, and <filename>bb.debug</filename>.</para></listitem>
389 </itemizedlist> 390 </itemizedlist>
390 </para> 391 </para>
391 392
393 <para>
394 For guidance on <filename>echo</filename> how logging is handled
395 in both Python and Bash recipes, see the
396 <filename>logging.bbclass</filename> file in the
397 <filename>meta/classes</filename> directory of the Yocto Project files.
398 </para>
399
392 <section id='logging-with-python'> 400 <section id='logging-with-python'>
393 <title>Logging With Python</title> 401 <title>Logging With Python</title>
394 <para> 402 <para>
@@ -426,14 +434,8 @@
426 <para> 434 <para>
427 When creating recipes using Bash and inserting code that handles build 435 When creating recipes using Bash and inserting code that handles build
428 logs you have the same goals - informative with minimal console output. 436 logs you have the same goals - informative with minimal console output.
429 Use the <filename>echo</filename> command and prepend the diagnostic string 437 The syntax you use for recipes written in Bash is similar to that of
430 with the appropriate loglevel floowed by the colon character. 438 recipes written in Python described in the previous section.
431 </para>
432
433 <para>
434 For guidance on <filename>echo</filename> usage in Bash recipes, see the
435 <filename>logging.bbclass</filename> file in the
436 <filename>meta/classes</filename> directory of the Yocto Project files.
437 </para> 439 </para>
438 440
439 <para> 441 <para>
@@ -441,21 +443,21 @@
441 The code logs the progress of the <filename>do_my_function</filename> function. 443 The code logs the progress of the <filename>do_my_function</filename> function.
442 <literallayout class='monospaced'> 444 <literallayout class='monospaced'>
443 do_my_function() { 445 do_my_function() {
444 echo "Running do_my_function()" 446 bbdebug 2 "Running do_my_function"
445 if [ exceptional_condition ]; then 447 if [ exceptional_condition ]; then
446 echo "NOTE: hit exceptional_condition" 448 bbnote "Hit exceptional_condition"
447 fi 449 fi
448 echo "DEBUG: got to point xyz" 450 bbdebug 2 "Got to point xyz"
449 if [ warning_trigger ]; then 451 if [ warning_trigger ]; then
450 echo "WARNING: detected warning_trigger, this might cause a plroblem later." 452 warn "Detected warning_trigger, this might cause a problem later."
451 fi 453 fi
452 if [ recoverable_error ]; then 454 if [ recoverable_error ]; then
453 echo "ERROR: hit recoverable_error, correcting" 455 error "Hit recoverable_error, correcting"
454 fi 456 fi
455 if [ fatal_error ]; then 457 if [ fatal_error ]; then
456 echo "FATAL: fatal_error detected" 458 fatal "fatal_error detected"
457 fi 459 fi
458 echo "Completed do_my_function" 460 debug 2 "Completed do_my_function"
459 } 461 }
460 </literallayout> 462 </literallayout>
461 </para> 463 </para>