Closed VLukasBecker closed 3 months ago
@VLukasBecker I'm going to run a few manual tests across a Linux VM and Windows.
I love it! As an experiment, I changed the 'Updating participant status' message in SystemStateTracker.cpp
to use the new LoggerMessage
and the results are great:
Log::LoggerMessage lm{_logger, Log::Level::Debug};
lm.SetMessage("Updating participant status");
lm.SetKeyValue("participant name", participantName);
lm.SetKeyValue("old participant state", fmt::to_string(oldParticipantState));
lm.SetKeyValue("new participant state", fmt::to_string(newParticipantState));
lm.Dispatch();
The 'simple' logger produces the following output:
[2024-07-25 13:17:23.558] [EthernetReader] [debug] Updating participant status, participant name: EthernetWriter, new participant state: Shutdown, old participant state: ShuttingDown
The JSON logger produces this (pretty-printed by jq
):
{
"ts": "1721906243558938",
"log": "EthernetReader",
"lvl": "debug",
"msg": "Updating participant status",
"kv": {
"participant name": "EthernetWriter",
"new participant state": "Shutdown",
"old participant state": "ShuttingDown"
}
}
Subject
Adds the configuration option to output log messages in a structure JSON format.
Instructions for review / testing
Developer checklist (address before review)