This RFC aims to collect a variety of use cases of logging statements, that will be used to establish the convention and design of the C++ Logging API/SDK in #337.
The goal is to obtain a collection of observability-specific logging statements that:
- use different data types (custom or built in)
- use different formats (template or string), and
- are simple and intuitive to learn and write.
Example Submission
Simple structured logging of a map:
unordered_map<string, int> mymap = {{ "First", 1 },
{ "Second",2 }
{ "Third", 3 }
};
Write the map to the logger, along with the severity and message:
logger.DEBUG("Outputting a map ", mymap);
This code snippet creates a log with a map attached to it. This is a type of structured logging, since the data holds a relationship with itself through key/value pairs. If this log were converted to JSON, it may have the following structure:
{
"SeverityLevel": DEBUG,
"Timestamp": Oct 07 10:59AM,
"Message": "Outputting a map",
"map1": {
"First": 1,
"Second": 2,
"Third": 3
}
}
Request for Comments
Please comment below to add examples of log formats and the different ways logging can be performed in C++, with the relevant data definitions (if applicable).
cc: @MarkSeufert @alolita @reyang @maxgolov @ThomsonTan
This RFC aims to collect a variety of use cases of logging statements, that will be used to establish the convention and design of the C++ Logging API/SDK in #337.
The goal is to obtain a collection of observability-specific logging statements that:
Example Submission
Simple structured logging of a map:
Write the map to the logger, along with the severity and message:
This code snippet creates a log with a map attached to it. This is a type of structured logging, since the data holds a relationship with itself through key/value pairs. If this log were converted to JSON, it may have the following structure:
Request for Comments
Please comment below to add examples of log formats and the different ways logging can be performed in C++, with the relevant data definitions (if applicable).
cc: @MarkSeufert @alolita @reyang @maxgolov @ThomsonTan