Skip to content

Commit f2a9dec

Browse files
authored
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
1 parent 309204d commit f2a9dec

File tree

6 files changed

+16
-16
lines changed

6 files changed

+16
-16
lines changed

include/spdlog/async_logger-inl.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,15 +57,15 @@ SPDLOG_LOGGER_CATCH(source_loc())
5757
//
5858
// backend functions - called from the thread pool to do the actual job
5959
//
60-
SPDLOG_INLINE void spdlog::async_logger::backend_sink_it_(const details::log_msg &msg) {
60+
SPDLOG_INLINE void spdlog::async_logger::backend_sink_it_(const details::log_msg &incoming_log_msg) {
6161
for (auto &sink : sinks_) {
62-
if (sink->should_log(msg.level)) {
63-
SPDLOG_TRY { sink->log(msg); }
64-
SPDLOG_LOGGER_CATCH(msg.source)
62+
if (sink->should_log(incoming_log_msg.level)) {
63+
SPDLOG_TRY { sink->log(incoming_log_msg); }
64+
SPDLOG_LOGGER_CATCH(incoming_log_msg.source)
6565
}
6666
}
6767

68-
if (should_flush_(msg)) {
68+
if (should_flush_(incoming_log_msg)) {
6969
backend_flush_();
7070
}
7171
}

include/spdlog/cfg/argv.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ inline void load_argv_levels(int argc, const char **argv) {
2626
for (int i = 1; i < argc; i++) {
2727
std::string arg = argv[i];
2828
if (arg.find(spdlog_level_prefix) == 0) {
29-
auto levels_string = arg.substr(spdlog_level_prefix.size());
30-
helpers::load_levels(levels_string);
29+
const auto levels_spec = arg.substr(spdlog_level_prefix.size());
30+
helpers::load_levels(levels_spec);
3131
}
3232
}
3333
}

include/spdlog/cfg/env.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@
2626
namespace spdlog {
2727
namespace cfg {
2828
inline void load_env_levels(const char* var = "SPDLOG_LEVEL") {
29-
auto env_val = details::os::getenv(var);
30-
if (!env_val.empty()) {
31-
helpers::load_levels(env_val);
29+
const auto levels_spec = details::os::getenv(var);
30+
if (!levels_spec.empty()) {
31+
helpers::load_levels(levels_spec);
3232
}
3333
}
3434

include/spdlog/cfg/helpers-inl.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,20 +70,20 @@ inline std::unordered_map<std::string, std::string> extract_key_vals_(const std:
7070
return rv;
7171
}
7272

73-
SPDLOG_INLINE void load_levels(const std::string &input) {
74-
if (input.empty() || input.size() >= 32768) {
73+
SPDLOG_INLINE void load_levels(const std::string &levels_spec) {
74+
if (levels_spec.empty() || levels_spec.size() >= 32768) {
7575
return;
7676
}
7777

78-
auto key_vals = extract_key_vals_(input);
78+
auto key_vals = extract_key_vals_(levels_spec);
7979
std::unordered_map<std::string, level::level_enum> levels;
8080
level::level_enum global_level = level::info;
8181
bool global_level_found = false;
8282

8383
for (auto &name_level : key_vals) {
8484
const auto &logger_name = name_level.first;
8585
const auto &level_name = to_lower_(name_level.second);
86-
auto level = level::from_str(level_name);
86+
const auto level = level::from_str(level_name);
8787
// ignore unrecognized level names
8888
if (level == level::off && level_name != "off") {
8989
continue;

include/spdlog/cfg/helpers.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ namespace helpers {
1818
// turn off all logging except for logger1: "off,logger1=debug"
1919
// turn off all logging except for logger1 and logger2: "off,logger1=debug,logger2=info"
2020
//
21-
SPDLOG_API void load_levels(const std::string &txt);
21+
SPDLOG_API void load_levels(const std::string &levels_spec);
2222
} // namespace helpers
2323

2424
} // namespace cfg

include/spdlog/spdlog.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ SPDLOG_API level::level_enum get_level();
7575
SPDLOG_API void set_level(level::level_enum log_level);
7676

7777
// Determine whether the default logger should log messages with a certain level
78-
SPDLOG_API bool should_log(level::level_enum lvl);
78+
SPDLOG_API bool should_log(level::level_enum log_level);
7979

8080
// Set a global flush level
8181
SPDLOG_API void flush_on(level::level_enum log_level);

0 commit comments

Comments
 (0)