Skip to content

Commit

Permalink
Use std::string in create_logger to avoid valgrind warning in some co…
Browse files Browse the repository at this point in the history
…nfigs.
  • Loading branch information
aarongreig committed Jan 3, 2025
1 parent ad288bb commit 7121a60
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions source/common/logger/ur_logger.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,16 +118,16 @@ inline Logger create_logger(std::string logger_name, bool skip_prefix,
logger::Level default_log_level) {
std::transform(logger_name.begin(), logger_name.end(), logger_name.begin(),
::toupper);
std::stringstream env_var_name;
const auto default_flush_level = logger::Level::ERR;
const std::string default_output = "stderr";
auto level = default_log_level;
auto flush_level = default_flush_level;
std::unique_ptr<logger::Sink> sink;

env_var_name << "UR_LOG_" << logger_name;
auto env_var_name = "UR_LOG_" + logger_name;
std::cout << "env var name: " << env_var_name << std::endl;
try {
auto map = getenv_to_map(env_var_name.str().c_str());
auto map = getenv_to_map(env_var_name.c_str());
if (!map.has_value()) {
return Logger(
default_log_level,
Expand Down Expand Up @@ -173,7 +173,7 @@ inline Logger create_logger(std::string logger_name, bool skip_prefix,
skip_linebreak);
} catch (const std::invalid_argument &e) {
std::cerr << "Error when creating a logger instance from the '"
<< env_var_name.str() << "' environment variable:\n"
<< env_var_name << "' environment variable:\n"
<< e.what() << std::endl;
return Logger(default_log_level,
std::make_unique<logger::StderrSink>(
Expand Down

0 comments on commit 7121a60

Please sign in to comment.