Implement printf_logmain with vprintf_logwriter

The implementation of printf_logmain now is only a wrapper
to vprintf_logwriter. So changes to the log system must be made
only at one place.

Removed also global object g_logmain. A temporary object of type
logwriter_t is used to call functions of logwriter.
Add log_channel_CONSOLE

The current use of log_channel_TEST is replaced with log_channel_CONSOLE.
From now on log_channel_TEST is used for additional TEST output in
a running system.
Implement addtimestamp_logwriter

The function is tested but not used at this moment.

A future change in the interface of log_it will allow to prefix
a log entry with a timestamp.
Add parameter log_flags_e to log_it.printf

The function printf of interface log_it is extended
with an additional parameter flags.

flags knows of thre values:
log_flags_TIMESTAMP - Adds a timestamp in front of a new log entry.
log_flags_START     - Marks the start of a log entry.
log_flags_END       - Marks the last call to printf. Beginning with the call
                      whose flags argument contained log_flags_START until
                      the call whose flags arg contains log_flags_END are added
                      to a memory buffer before they are written. The content
                      is truncated if necessary.

Changed meaning of log_channel_CONSOLE: default log output is written
to STDERR instead of STDOUT. The newly implemented function logformat_test
is now used to write the state of execution of the running unittest
instead of log_channel_CONSOLE.

Refactored part of logwriter_t into logbuffer_t.
logmain now uses logbuffer_t to implement its functionality.

Added timestamp to all ERRLOG output. The comparison function for
test log files is adapted to ignore the timestamp.

Also renamed isopen_file into isvalid_file and implemented
isvalid_iochannel which duplicates the functionality of isvalid_file.