cxx/logging: only start sending CMDP messages once a name is set
This MR finally tries to fix a problem we had quite for a while: we do logging before we know from what the sender name actually is.
The idea is to queue log messages in a queue, and only start sending messages from this queue once a name is set. The sending is done in a separate thread and waits for messages with the condition-variable-pattern.
TODO:
-
Add an option to disable CMDP entirely - otherwise CLI tools might queue a lot of messages (like the CLI logger). One option would be to set cmdp_global_level_
toOFF
by default - we needTRACE
for most cases though to send delayed messages. -
Move registering via CHIRP to CMDPSink::enableSending
: first start subscription thread, then announce via chirp, then wait, then start sending thread. -
Copy the cmdp_console_logger_
logger to theCMDPSink
, so that we also can log things there.
Edited by Stephan Lachnit