====== Introduction ======

The diagnostic module (acronym: diag) is responsible for providing easy to use tools for logging diagnostic messages. 

====== Diagnostic model ======

This is what has been used so far in HALFRED:

The diag module delivers independent diagnostic channels.  Each diagnostic channel:
  * has an IODevice, through which it logs
  * can be switched on and off

Usually every independent software component has it's own diagnostic channel. A diagnostic channels supports these operations:
  * printing strings
  * printing values (int, float, + formatting like hex etc.)

Each operation has an assigned severity level. We're using [[http://en.wikipedia.org/wiki/Syslog#Severity_levels|syslog severity level]] definitions (defined in [[http://tools.ietf.org/html/rfc5424|RFC5424]]).

====== Desired semantics ======

This is what I evision is feasible:

<code cpp>
diagChannel.setOutputDevice(usart2);
diagChannel.enable();
diagChannel << warning << "This is a warning" << endl << notice << "Notice: you can ignore it" << endl;

</code>

====== Performance requirements ======

Now here's the tricky part. We want to optimize-out the unused strings. So in this example:

<code cpp>
const hal::DiagMinSeverityLevel = WARNING;
...
diagChannel << warning << "This is a warning" << endl << notice << "Notice: you can ignore it" << endl;
</code>

the "Notice: you can ignore it" should be removed by the linker :)
