-
Notifications
You must be signed in to change notification settings - Fork 30
Open
Labels
featureNew feature or requestNew feature or request
Description
By default the logger puts a new line after every log, maybe it is a good idea to add an option to miss adding '\n' at the end. Sometimes maybe the message already has new line.
example:
current implementation:
std::string my_fmt = "this example will print value {}!\n";
int32_t value = 5;
logger_instance->info(my_fmt,value);
logger_instance->info("Hello Chris!");
............
Output
............
this example will print value 5!
Hello Chris!
with the feature from proposal:
std::string my_fmt = "this example will print value {}!\n";
int32_t value = 5;
logger_instance->info(my_fmt,value,lwlog::without_new_line);
// or the one below compile time
logger_instance->info<lwlog::new_line_policy::without>(my_fmt,value);
logger_instance->info("Hello Chris!");
............
Output
............
this example will print value 5!
Hello Chris!
Maybe inside the info,warning,error,critical,trace you can add an if constexpr to remove the last char if it is '\n'
Pseudo code:
template<lwlog::new_line_policy line_policy = lwlog::new_line_policy::include>
lwlog::logger_instance_t::info(const char* fmt,........)
.......
if constexpr(line_policy == lwlog::new_line_policy::without)
{
//remove last char
}
//do whatever you were doing
}
Metadata
Metadata
Assignees
Labels
featureNew feature or requestNew feature or request