generic-poky/documentation/ref-manual/eclipse/html/poky-ref-manual/logging-with-bash.html

48 lines
2.1 KiB
HTML
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>2.3.7.2. Logging With Bash</title>
<link rel="stylesheet" type="text/css" href="../book.css">
<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
<link rel="home" href="index.html" title="The Yocto Project Reference Manual">
<link rel="up" href="recipe-logging-mechanisms.html" title="2.3.7. Recipe Logging Mechanisms">
<link rel="prev" href="logging-with-python.html" title="2.3.7.1. Logging With Python">
<link rel="next" href="usingpoky-debugging-others.html" title="2.3.8. Other Tips">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="section" title="2.3.7.2. Logging With Bash">
<div class="titlepage"><div><div><h4 class="title">
<a name="logging-with-bash"></a>2.3.7.2. Logging With Bash</h4></div></div></div>
<p>
When creating recipes using Bash and inserting code that handles build
logs you have the same goals - informative with minimal console output.
The syntax you use for recipes written in Bash is similar to that of
recipes written in Python described in the previous section.
</p>
<p>
Following is an example written in Bash.
The code logs the progress of the <code class="filename">do_my_function</code> function.
</p>
<pre class="literallayout">
do_my_function() {
bbdebug 2 "Running do_my_function"
if [ exceptional_condition ]; then
bbnote "Hit exceptional_condition"
fi
bbdebug 2 "Got to point xyz"
if [ warning_trigger ]; then
bbwarn "Detected warning_trigger, this might cause a problem later."
fi
if [ recoverable_error ]; then
bberror "Hit recoverable_error, correcting"
fi
if [ fatal_error ]; then
bbfatal "fatal_error detected"
fi
bbdebug 2 "Completed do_my_function"
}
</pre>
<p>
</p>
</div></body>
</html>