Add Message logging

This commit is contained in:
RipleyTom
2026-01-29 00:37:04 +01:00
committed by Elad
parent 086ab3cb37
commit 97feb4eed4
3 changed files with 10 additions and 1 deletions

View File

@@ -188,7 +188,7 @@ namespace fmt
result.append(separator);
}
return result.append(source.back());
return result.append(*end);
}
template <typename T>

View File

@@ -1085,6 +1085,11 @@ namespace np
void np_handler::send_message(const message_data& msg_data, const std::set<std::string>& npids)
{
const std::string npids_string = fmt::format("\"%s\"", fmt::merge(npids, "\",\""));
rpcn_log.notice("Sending message to %s:", npids_string);
msg_data.print();
get_rpcn()->send_message(msg_data, npids);
}

View File

@@ -3122,6 +3122,7 @@ namespace rpcn
if (sdata.is_error())
{
rpcn_log.error("Error parsing MessageReceived notification");
return;
}
@@ -3143,6 +3144,9 @@ namespace rpcn
strcpy_trunc(mdata.commId.data, pb_mdata->communicationid());
mdata.data.assign(pb_mdata->data().begin(), pb_mdata->data().end());
rpcn_log.notice("Received message from %s:", sender);
mdata.print();
// Save the message and call callbacks
{
std::lock_guard lock(mutex_messages);