-
Notifications
You must be signed in to change notification settings - Fork 522
Closed
Labels
enhancementNew feature or requestNew feature or request
Description
Feature request
Feature description
Stream logging should be implemented as it
- has better type handling (type safety and no need to change a format string if the type changes)
- allows simple output of types not supported by the
printfformat specifiers.
Implementation considerations
The stream log commands could use the existing log functions. Simplified example:
#include <sstream>
#define LOG(...) printf(__VA_ARGS__)
#define LOG_STREAM(args) std::stringstream ss; ss << args; LOG("%s", ss.str().c_str())
int main()
{
int a = 2019;
std::string s = "World";
LOG("Hello %s %i\n", s.c_str(), a);
LOG_STREAM("Hello " << s << " " << a << "\n");
return 0;
}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request