readability-named-parameter

This commit is contained in:
Daniel Chabrowski 2018-02-25 12:39:37 +01:00
parent 35a843f8b6
commit 5355bd3a8f
4 changed files with 22 additions and 28 deletions

View File

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

View File

@ -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<class It>
logger(const std::string& name, sinks_init_list sinks);
template <class It>
logger(std::string name, const It& begin, const It& end);
virtual ~logger();
@ -44,7 +45,6 @@ public:
template <typename Arg1, typename... Args> void error(const char* fmt, const Arg1&, const Args&... args);
template <typename Arg1, typename... Args> void critical(const char* fmt, const Arg1&, const Args&... args);
#ifdef SPDLOG_WCHAR_TO_UTF8_SUPPORT
template <typename... Args> void log(level::level_enum lvl, const wchar_t* msg);
template <typename... Args> 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 <typename T> void log(level::level_enum lvl, const T&);
template <typename T> void trace(const T&);
template <typename T> void debug(const T&);
template <typename T> void info(const T&);
template <typename T> void warn(const T&);
template <typename T> void error(const T&);
template <typename T> void critical(const T&);
template <typename T> void trace(const T& msg);
template <typename T> void debug(const T& msg);
template <typename T> void info(const T& msg);
template <typename T> void warn(const T& msg);
template <typename T> void error(const T& msg);
template <typename T> 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<sink_ptr>& 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<sink_ptr> _sinks;

View File

@ -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<logger> create(const std::string& logger_name, const It& sinks_b
// Example:
// spdlog::create<daily_file_sink_st>("mylog", "dailylog_filename");
template <typename Sink, typename... Args>
std::shared_ptr<spdlog::logger> create(const std::string& logger_name, Args...);
std::shared_ptr<spdlog::logger> create(const std::string& logger_name, Args... args);
// Create and register an async logger with a single sink
std::shared_ptr<logger> 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<void()>& worker_warmup_cb = nullptr, const std::chrono::milliseconds& flush_interval_ms = std::chrono::milliseconds::zero(), const std::function<void()>& worker_teardown_cb = nullptr);

View File

@ -1,4 +1,3 @@
#include "includes.h"
template<class T>
@ -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