broker: Include log event identifier in stderr output

This commit is contained in:
Arne Welzel 2025-04-14 14:06:59 +02:00
parent ba5dcb1d84
commit 6c44bfa3fb

View file

@ -1167,8 +1167,11 @@ void Manager::ProcessLogEvents() {
event_mgr.Enqueue(::Broker::internal_log_event, std::move(args)); event_mgr.Enqueue(::Broker::internal_log_event, std::move(args));
} }
if ( bstate->stderrSeverity >= severity ) { if ( bstate->stderrSeverity >= severity ) {
fprintf(stderr, "[BROKER/%s] %s\n", severity_names_tbl[static_cast<int>(severity)], // Formatting the event->identifier string_view using "%.*s" - the explicit
event->description.c_str()); // precision ".*" allows specifying the length of the following char* argument
// as string_views in general are not guaranteed to be null terminated.
fprintf(stderr, "[BROKER/%s] %.*s: %s\n", severity_names_tbl[static_cast<int>(severity)],
static_cast<int>(event->identifier.size()), event->identifier.data(), event->description.c_str());
} }
} }
} }