mirror of
https://github.com/gabime/spdlog.git
synced 2026-04-10 11:34:29 +08: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:
@@ -57,15 +57,15 @@ SPDLOG_LOGGER_CATCH(source_loc())
|
|||||||
//
|
//
|
||||||
// backend functions - called from the thread pool to do the actual job
|
// 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_) {
|
for (auto &sink : sinks_) {
|
||||||
if (sink->should_log(msg.level)) {
|
if (sink->should_log(incoming_log_msg.level)) {
|
||||||
SPDLOG_TRY { sink->log(msg); }
|
SPDLOG_TRY { sink->log(incoming_log_msg); }
|
||||||
SPDLOG_LOGGER_CATCH(msg.source)
|
SPDLOG_LOGGER_CATCH(incoming_log_msg.source)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (should_flush_(msg)) {
|
if (should_flush_(incoming_log_msg)) {
|
||||||
backend_flush_();
|
backend_flush_();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,8 +26,8 @@ inline void load_argv_levels(int argc, const char **argv) {
|
|||||||
for (int i = 1; i < argc; i++) {
|
for (int i = 1; i < argc; i++) {
|
||||||
std::string arg = argv[i];
|
std::string arg = argv[i];
|
||||||
if (arg.find(spdlog_level_prefix) == 0) {
|
if (arg.find(spdlog_level_prefix) == 0) {
|
||||||
auto levels_string = arg.substr(spdlog_level_prefix.size());
|
const auto levels_spec = arg.substr(spdlog_level_prefix.size());
|
||||||
helpers::load_levels(levels_string);
|
helpers::load_levels(levels_spec);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,9 +26,9 @@
|
|||||||
namespace spdlog {
|
namespace spdlog {
|
||||||
namespace cfg {
|
namespace cfg {
|
||||||
inline void load_env_levels(const char* var = "SPDLOG_LEVEL") {
|
inline void load_env_levels(const char* var = "SPDLOG_LEVEL") {
|
||||||
auto env_val = details::os::getenv(var);
|
const auto levels_spec = details::os::getenv(var);
|
||||||
if (!env_val.empty()) {
|
if (!levels_spec.empty()) {
|
||||||
helpers::load_levels(env_val);
|
helpers::load_levels(levels_spec);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -70,12 +70,12 @@ inline std::unordered_map<std::string, std::string> extract_key_vals_(const std:
|
|||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
SPDLOG_INLINE void load_levels(const std::string &input) {
|
SPDLOG_INLINE void load_levels(const std::string &levels_spec) {
|
||||||
if (input.empty() || input.size() >= 32768) {
|
if (levels_spec.empty() || levels_spec.size() >= 32768) {
|
||||||
return;
|
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;
|
std::unordered_map<std::string, level::level_enum> levels;
|
||||||
level::level_enum global_level = level::info;
|
level::level_enum global_level = level::info;
|
||||||
bool global_level_found = false;
|
bool global_level_found = false;
|
||||||
@@ -83,7 +83,7 @@ SPDLOG_INLINE void load_levels(const std::string &input) {
|
|||||||
for (auto &name_level : key_vals) {
|
for (auto &name_level : key_vals) {
|
||||||
const auto &logger_name = name_level.first;
|
const auto &logger_name = name_level.first;
|
||||||
const auto &level_name = to_lower_(name_level.second);
|
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
|
// ignore unrecognized level names
|
||||||
if (level == level::off && level_name != "off") {
|
if (level == level::off && level_name != "off") {
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ namespace helpers {
|
|||||||
// turn off all logging except for logger1: "off,logger1=debug"
|
// turn off all logging except for logger1: "off,logger1=debug"
|
||||||
// turn off all logging except for logger1 and logger2: "off,logger1=debug,logger2=info"
|
// 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 helpers
|
||||||
|
|
||||||
} // namespace cfg
|
} // namespace cfg
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ SPDLOG_API level::level_enum get_level();
|
|||||||
SPDLOG_API void set_level(level::level_enum log_level);
|
SPDLOG_API void set_level(level::level_enum log_level);
|
||||||
|
|
||||||
// Determine whether the default logger should log messages with a certain 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
|
// Set a global flush level
|
||||||
SPDLOG_API void flush_on(level::level_enum log_level);
|
SPDLOG_API void flush_on(level::level_enum log_level);
|
||||||
|
|||||||
Reference in New Issue
Block a user