Skip to content

cxx/logging: only start sending CMDP messages once a name is set

Stephan Lachnit requested to merge p-logging-delayed into main

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_ to OFF by default - we need TRACE 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 the CMDPSink, so that we also can log things there.
Edited by Stephan Lachnit

Merge request reports