diff --git a/include/spdlog/details/async_log_helper.h b/include/spdlog/details/async_log_helper.h index b39b2c10..0dbc107c 100644 --- a/include/spdlog/details/async_log_helper.h +++ b/include/spdlog/details/async_log_helper.h @@ -139,7 +139,7 @@ public: async_log_helper(const async_log_helper&) = delete; async_log_helper& operator=(const async_log_helper&) = delete; - void set_formatter(formatter_ptr); + void set_formatter(formatter_ptr msg_formatter); void flush(bool wait_for_q); diff --git a/include/spdlog/logger.h b/include/spdlog/logger.h index 8d456b9b..5502d273 100644 --- a/include/spdlog/logger.h +++ b/include/spdlog/logger.h @@ -26,8 +26,9 @@ class logger { public: logger(const std::string& name, sink_ptr single_sink); - logger(const std::string& name, sinks_init_list); - template + logger(const std::string& name, sinks_init_list sinks); + + template logger(std::string name, const It& begin, const It& end); virtual ~logger(); @@ -44,7 +45,6 @@ public: template void error(const char* fmt, const Arg1&, const Args&... args); template void critical(const char* fmt, const Arg1&, const Args&... args); - #ifdef SPDLOG_WCHAR_TO_UTF8_SUPPORT template void log(level::level_enum lvl, const wchar_t* msg); template void log(level::level_enum lvl, const wchar_t* fmt, const Args&... args); @@ -57,19 +57,19 @@ public: #endif // SPDLOG_WCHAR_TO_UTF8_SUPPORT template void log(level::level_enum lvl, const T&); - template void trace(const T&); - template void debug(const T&); - template void info(const T&); - template void warn(const T&); - template void error(const T&); - template void critical(const T&); + template void trace(const T& msg); + template void debug(const T& msg); + template void info(const T& msg); + template void warn(const T& msg); + template void error(const T& msg); + template void critical(const T& msg); - bool should_log(level::level_enum) const; - void set_level(level::level_enum); + bool should_log(level::level_enum msg_level) const; + void set_level(level::level_enum log_level); level::level_enum level() const; const std::string& name() const; - void set_pattern(const std::string&, pattern_time_type = pattern_time_type::local); - void set_formatter(formatter_ptr); + void set_pattern(const std::string& pattern, pattern_time_type pattern_time = pattern_time_type::local); + void set_formatter(formatter_ptr msg_formatter); // automatically call flush() if message level >= log_level void flush_on(level::level_enum log_level); @@ -79,22 +79,22 @@ public: const std::vector& sinks() const; // error handler - virtual void set_error_handler(log_err_handler); + virtual void set_error_handler(log_err_handler err_handler); virtual log_err_handler error_handler(); protected: - virtual void _sink_it(details::log_msg&); - virtual void _set_pattern(const std::string&, pattern_time_type); - virtual void _set_formatter(formatter_ptr); + virtual void _sink_it(details::log_msg& msg); + virtual void _set_pattern(const std::string& pattern, pattern_time_type pattern_time); + virtual void _set_formatter(formatter_ptr msg_formatter); // default error handler: print the error to stderr with the max rate of 1 message/minute virtual void _default_err_handler(const std::string &msg); // return true if the given message level should trigger a flush - bool _should_flush_on(const details::log_msg&); + bool _should_flush_on(const details::log_msg& msg); // increment the message count (only if defined(SPDLOG_ENABLE_MESSAGE_COUNTER)) - void _incr_msg_counter(details::log_msg &msg); + void _incr_msg_counter(details::log_msg& msg); const std::string _name; std::vector _sinks; diff --git a/include/spdlog/spdlog.h b/include/spdlog/spdlog.h index 076833d0..8965e59f 100644 --- a/include/spdlog/spdlog.h +++ b/include/spdlog/spdlog.h @@ -46,7 +46,7 @@ void flush_on(level::level_enum log_level); // // Set global error handler // -void set_error_handler(log_err_handler); +void set_error_handler(log_err_handler handler); // // Turn on async mode (off by default) and set the queue size for each async_logger. @@ -129,7 +129,7 @@ std::shared_ptr create(const std::string& logger_name, const It& sinks_b // Example: // spdlog::create("mylog", "dailylog_filename"); template -std::shared_ptr create(const std::string& logger_name, Args...); +std::shared_ptr create(const std::string& logger_name, Args... args); // Create and register an async logger with a single sink std::shared_ptr create_async(const std::string& logger_name, const sink_ptr& sink, size_t queue_size, const async_overflow_policy overflow_policy = async_overflow_policy::block_retry, const std::function& worker_warmup_cb = nullptr, const std::chrono::milliseconds& flush_interval_ms = std::chrono::milliseconds::zero(), const std::function& worker_teardown_cb = nullptr); diff --git a/tests/test_misc.cpp b/tests/test_misc.cpp index 4f6ee72c..9afaa932 100644 --- a/tests/test_misc.cpp +++ b/tests/test_misc.cpp @@ -1,4 +1,3 @@ - #include "includes.h" template @@ -16,11 +15,6 @@ std::string log_info(const T& what, spdlog::level::level_enum logger_level = spd return oss.str().substr(0, oss.str().length() - strlen(spdlog::details::os::default_eol)); } - - - - - TEST_CASE("basic_logging ", "[basic_logging]") { //const char