Skip to content

Commit

Permalink
Fix mixed log using string concat (#200)
Browse files Browse the repository at this point in the history
  • Loading branch information
aureplop authored Sep 22, 2021
1 parent 0bbcf05 commit 0cb27e4
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions include/datadog/opentracing.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,20 +117,22 @@ struct TracerOptions {
// A logging function that is called by the tracer when noteworthy events occur.
// The default value uses std::cerr, and applications can inject their own logging function.
LogFunc log_func = [](LogLevel level, ot::string_view message) {
std::string level_str;
switch (level) {
case LogLevel::debug:
std::cerr << "debug: " << message << std::endl;
level_str = "debug";
break;
case LogLevel::info:
std::cerr << "info: " << message << std::endl;
level_str = "info";
break;
case LogLevel::error:
std::cerr << "error: " << message << std::endl;
level_str = "error";
break;
default:
std::cerr << "<unknown level>: " << message << std::endl;
level_str = "<unknown level>";
break;
}
std::cerr << level_str + ": " + message.data() + "\n";
};
};

Expand Down

0 comments on commit 0cb27e4

Please sign in to comment.