diff --git a/include/spdlog/async_logger-inl.h b/include/spdlog/async_logger-inl.h index cde73f90..382ef07a 100644 --- a/include/spdlog/async_logger-inl.h +++ b/include/spdlog/async_logger-inl.h @@ -57,15 +57,15 @@ SPDLOG_LOGGER_CATCH(source_loc()) // // backend functions - called from the thread pool to do the actual job // -SPDLOG_INLINE void spdlog::async_logger::backend_sink_it_(const details::log_msg &msg) { +SPDLOG_INLINE void spdlog::async_logger::backend_sink_it_(const details::log_msg &incoming_log_msg) { for (auto &sink : sinks_) { - if (sink->should_log(msg.level)) { - SPDLOG_TRY { sink->log(msg); } - SPDLOG_LOGGER_CATCH(msg.source) + if (sink->should_log(incoming_log_msg.level)) { + SPDLOG_TRY { sink->log(incoming_log_msg); } + SPDLOG_LOGGER_CATCH(incoming_log_msg.source) } } - if (should_flush_(msg)) { + if (should_flush_(incoming_log_msg)) { backend_flush_(); } } diff --git a/include/spdlog/cfg/argv.h b/include/spdlog/cfg/argv.h index 7de2f83e..64cf3898 100644 --- a/include/spdlog/cfg/argv.h +++ b/include/spdlog/cfg/argv.h @@ -26,8 +26,8 @@ inline void load_argv_levels(int argc, const char **argv) { for (int i = 1; i < argc; i++) { std::string arg = argv[i]; if (arg.find(spdlog_level_prefix) == 0) { - auto levels_string = arg.substr(spdlog_level_prefix.size()); - helpers::load_levels(levels_string); + const auto levels_spec = arg.substr(spdlog_level_prefix.size()); + helpers::load_levels(levels_spec); } } } diff --git a/include/spdlog/cfg/env.h b/include/spdlog/cfg/env.h index 47bf61c7..cb153e05 100644 --- a/include/spdlog/cfg/env.h +++ b/include/spdlog/cfg/env.h @@ -26,9 +26,9 @@ namespace spdlog { namespace cfg { inline void load_env_levels(const char* var = "SPDLOG_LEVEL") { - auto env_val = details::os::getenv(var); - if (!env_val.empty()) { - helpers::load_levels(env_val); + const auto levels_spec = details::os::getenv(var); + if (!levels_spec.empty()) { + helpers::load_levels(levels_spec); } } diff --git a/include/spdlog/cfg/helpers-inl.h b/include/spdlog/cfg/helpers-inl.h index 6ed86955..01050367 100644 --- a/include/spdlog/cfg/helpers-inl.h +++ b/include/spdlog/cfg/helpers-inl.h @@ -70,12 +70,12 @@ inline std::unordered_map extract_key_vals_(const std: return rv; } -SPDLOG_INLINE void load_levels(const std::string &input) { - if (input.empty() || input.size() >= 32768) { +SPDLOG_INLINE void load_levels(const std::string &levels_spec) { + if (levels_spec.empty() || levels_spec.size() >= 32768) { return; } - auto key_vals = extract_key_vals_(input); + auto key_vals = extract_key_vals_(levels_spec); std::unordered_map levels; level::level_enum global_level = level::info; bool global_level_found = false; @@ -83,7 +83,7 @@ SPDLOG_INLINE void load_levels(const std::string &input) { for (auto &name_level : key_vals) { const auto &logger_name = name_level.first; const auto &level_name = to_lower_(name_level.second); - auto level = level::from_str(level_name); + const auto level = level::from_str(level_name); // ignore unrecognized level names if (level == level::off && level_name != "off") { continue; diff --git a/include/spdlog/cfg/helpers.h b/include/spdlog/cfg/helpers.h index d09a1e97..25590e4e 100644 --- a/include/spdlog/cfg/helpers.h +++ b/include/spdlog/cfg/helpers.h @@ -18,7 +18,7 @@ namespace helpers { // turn off all logging except for logger1: "off,logger1=debug" // turn off all logging except for logger1 and logger2: "off,logger1=debug,logger2=info" // -SPDLOG_API void load_levels(const std::string &txt); +SPDLOG_API void load_levels(const std::string &levels_spec); } // namespace helpers } // namespace cfg diff --git a/include/spdlog/spdlog.h b/include/spdlog/spdlog.h index 681045e1..649318b2 100644 --- a/include/spdlog/spdlog.h +++ b/include/spdlog/spdlog.h @@ -75,7 +75,7 @@ SPDLOG_API level::level_enum get_level(); SPDLOG_API void set_level(level::level_enum log_level); // Determine whether the default logger should log messages with a certain level -SPDLOG_API bool should_log(level::level_enum lvl); +SPDLOG_API bool should_log(level::level_enum log_level); // Set a global flush level SPDLOG_API void flush_on(level::level_enum log_level);