2
0
mirror of https://github.com/gabime/spdlog.git synced 2026-01-19 04:52:09 +00:00

Fix function arguments names different warnings (#3519)

* helpers-inl.h - load_levels function arguments names different style warning fixed

* async_logger-inl.h - backend_sink_it_ function arguments names different style warning fixed

* spdlog-inl.g - should_log function arguments names different style warning fixed
This commit is contained in:
Kağan Can Şit
2026-01-11 22:56:46 +03:00
committed by GitHub
parent 309204d53c
commit f2a9dec029
6 changed files with 16 additions and 16 deletions

View File

@@ -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_();
}
}

View File

@@ -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);
}
}
}

View File

@@ -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);
}
}

View File

@@ -70,12 +70,12 @@ inline std::unordered_map<std::string, std::string> 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<std::string, level::level_enum> 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;

View File

@@ -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

View File

@@ -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);