Skip to content

Instantly share code, notes, and snippets.

@riyadixitagra
riyadixitagra / LG2_examle.txt
Created March 24, 2023 14:12
Aiming at highlighting the improvision in logging practices after migrating the pldm repository to Structured Log using LG2 api
PLDM repository was using standard ostream object std::cerr for logging errors and std::cout for logging information in journald. Following example shows an instance of log and the object it generates in journal json -
std::cerr << "test error logs0=" << 0 << ", log1=" << 1 <<", log2=" << 2 << "\n";
OR
int KEY0=0, KEY1= 1, KEY2= 2;
std::cerr << "test error logs0=" << KEY0 << ", log1=" << KEY1 << ", log2=" << KEY2 << "\n";
The journal object for above log -
{
"_GID" : "0",