Projekt

Allgemein

Profil

Logging » Historie » Revision 2

Revision 1 (Maximilian Seesslen, 21.12.2022 12:52) → Revision 2/6 (Maximilian Seesslen, 21.12.2022 13:29)

h1. Logging

There is no clean logging concept at the moment.

* Work within ISRs.
"trouble" function implemented for sensemux.
* Only short messages, e.g. 20 chars.
* Heart-beat LED might
It should be involved
* CAN might be involved
integrated to transmit diagnose
* Debug can be disabled even for Debug-builds; BIWAK_LOG_DEBUG has to be defined to show bDebug
an heartbeat class.

h2. Heartbeat-Class

An LED can indicate problems.

* good (double)
* crytical error (fast blink)
* fatal error (slow blink)
* temporary error/ trouble (fast blink - off 1Hz) (goes away)

h2. Usecases There are weak c functions: * trouble() * critical() * fatal()
Usecases:


* invalid eeprom causes "critical"-state
* Not being able to sen CAN messages causes "trouble"
* fatal: the application can not run for some reason but the led should work; e.g. a reception buffer is full
* exception: Don't even try to run any more. e.g. memory error.

h2. Examples

<pre><code class="cpp">
add_definitions( BIWAK_LOG_HEARTBEAT )
add_definitions( BIWAK_LOG_CAN )
add_definitions( BIWAK_LOG_DEBUG )

#define bDebug(a,...) debug(a, __VA_ARGS__)
</code></pre>

<pre><code class="cpp">
#include <biwak/log.hpp>

main()
{
bDebug(); // Just print some text
bCritical();
bTrouble(); //
bFatal();
bException("Static text");
}
</code></pre>