diff --git a/include/spdlog/async_logger.h b/include/spdlog/async_logger.h index c162f071..1cb92ea5 100644 --- a/include/spdlog/async_logger.h +++ b/include/spdlog/async_logger.h @@ -41,9 +41,9 @@ public: It end, std::weak_ptr tp, async_overflow_policy overflow_policy = async_overflow_policy::block) - : logger(std::move(logger_name), begin, end) - , thread_pool_(std::move(tp)) - , overflow_policy_(overflow_policy) {} + : logger(std::move(logger_name), begin, end), + thread_pool_(std::move(tp)), + overflow_policy_(overflow_policy) {} async_logger(std::string logger_name, sinks_init_list sinks_list, diff --git a/include/spdlog/common.h b/include/spdlog/common.h index 76b012cd..7d516dc6 100644 --- a/include/spdlog/common.h +++ b/include/spdlog/common.h @@ -306,9 +306,9 @@ private: struct source_loc { SPDLOG_CONSTEXPR source_loc() = default; SPDLOG_CONSTEXPR source_loc(const char *filename_in, int line_in, const char *funcname_in) - : filename{filename_in} - , line{line_in} - , funcname{funcname_in} {} + : filename{filename_in}, + line{line_in}, + funcname{funcname_in} {} SPDLOG_CONSTEXPR bool empty() const SPDLOG_NOEXCEPT { return line == 0; } const char *filename{nullptr}; @@ -318,10 +318,10 @@ struct source_loc { struct file_event_handlers { file_event_handlers() - : before_open(nullptr) - , after_open(nullptr) - , before_close(nullptr) - , after_close(nullptr) {} + : before_open(nullptr), + after_open(nullptr), + before_close(nullptr), + after_close(nullptr) {} std::function before_open; std::function after_open; diff --git a/include/spdlog/details/circular_q.h b/include/spdlog/details/circular_q.h index e7d68652..76ac1f1c 100644 --- a/include/spdlog/details/circular_q.h +++ b/include/spdlog/details/circular_q.h @@ -25,7 +25,8 @@ public: explicit circular_q(size_t max_items) : max_items_(max_items + 1) // one item is reserved as marker for full q - , v_(max_items_) {} + , + v_(max_items_) {} circular_q(const circular_q &) = default; circular_q &operator=(const circular_q &) = default; diff --git a/include/spdlog/details/log_msg-inl.h b/include/spdlog/details/log_msg-inl.h index 7e446395..4923fb8e 100644 --- a/include/spdlog/details/log_msg-inl.h +++ b/include/spdlog/details/log_msg-inl.h @@ -17,14 +17,16 @@ SPDLOG_INLINE log_msg::log_msg(spdlog::log_clock::time_point log_time, string_view_t a_logger_name, spdlog::level::level_enum lvl, spdlog::string_view_t msg) - : logger_name(a_logger_name) - , level(lvl) - , time(log_time) + : logger_name(a_logger_name), + level(lvl), + time(log_time) #ifndef SPDLOG_NO_THREAD_ID - , thread_id(os::thread_id()) + , + thread_id(os::thread_id()) #endif - , source(loc) - , payload(msg) { + , + source(loc), + payload(msg) { } SPDLOG_INLINE log_msg::log_msg(spdlog::source_loc loc, diff --git a/include/spdlog/details/thread_pool.h b/include/spdlog/details/thread_pool.h index 4aac7a86..cd6ac0f3 100644 --- a/include/spdlog/details/thread_pool.h +++ b/include/spdlog/details/thread_pool.h @@ -37,9 +37,9 @@ struct async_msg : log_msg_buffer { // support for vs2013 move #if defined(_MSC_VER) && _MSC_VER <= 1800 async_msg(async_msg &&other) - : log_msg_buffer(std::move(other)) - , msg_type(other.msg_type) - , worker_ptr(std::move(other.worker_ptr)) {} + : log_msg_buffer(std::move(other)), + msg_type(other.msg_type), + worker_ptr(std::move(other.worker_ptr)) {} async_msg &operator=(async_msg &&other) { *static_cast(this) = std::move(other); @@ -54,14 +54,14 @@ struct async_msg : log_msg_buffer { // construct from log_msg with given type async_msg(async_logger_ptr &&worker, async_msg_type the_type, const details::log_msg &m) - : log_msg_buffer{m} - , msg_type{the_type} - , worker_ptr{std::move(worker)} {} + : log_msg_buffer{m}, + msg_type{the_type}, + worker_ptr{std::move(worker)} {} async_msg(async_logger_ptr &&worker, async_msg_type the_type) - : log_msg_buffer{} - , msg_type{the_type} - , worker_ptr{std::move(worker)} {} + : log_msg_buffer{}, + msg_type{the_type}, + worker_ptr{std::move(worker)} {} explicit async_msg(async_msg_type the_type) : async_msg{nullptr, the_type} {} diff --git a/include/spdlog/fmt/bin_to_hex.h b/include/spdlog/fmt/bin_to_hex.h index 222d6f7f..b7440bba 100644 --- a/include/spdlog/fmt/bin_to_hex.h +++ b/include/spdlog/fmt/bin_to_hex.h @@ -43,9 +43,9 @@ template class dump_info { public: dump_info(It range_begin, It range_end, size_t size_per_line) - : begin_(range_begin) - , end_(range_end) - , size_per_line_(size_per_line) {} + : begin_(range_begin), + end_(range_end), + size_per_line_(size_per_line) {} // do not use begin() and end() to avoid collision with fmt/ranges It get_begin() const { return begin_; } diff --git a/include/spdlog/logger-inl.h b/include/spdlog/logger-inl.h index e6ea2f9b..8fe8fe01 100644 --- a/include/spdlog/logger-inl.h +++ b/include/spdlog/logger-inl.h @@ -17,12 +17,12 @@ namespace spdlog { // public methods SPDLOG_INLINE logger::logger(const logger &other) - : name_(other.name_) - , sinks_(other.sinks_) - , level_(other.level_.load(std::memory_order_relaxed)) - , flush_level_(other.flush_level_.load(std::memory_order_relaxed)) - , custom_err_handler_(other.custom_err_handler_) - , tracer_(other.tracer_) {} + : name_(other.name_), + sinks_(other.sinks_), + level_(other.level_.load(std::memory_order_relaxed)), + flush_level_(other.flush_level_.load(std::memory_order_relaxed)), + custom_err_handler_(other.custom_err_handler_), + tracer_(other.tracer_) {} SPDLOG_INLINE logger::logger(logger &&other) SPDLOG_NOEXCEPT : name_(std::move(other.name_)), diff --git a/include/spdlog/logger.h b/include/spdlog/logger.h index 3df6e321..d1c81fda 100644 --- a/include/spdlog/logger.h +++ b/include/spdlog/logger.h @@ -51,14 +51,14 @@ class SPDLOG_API logger { public: // Empty logger explicit logger(std::string name) - : name_(std::move(name)) - , sinks_() {} + : name_(std::move(name)), + sinks_() {} // Logger with range on sinks template logger(std::string name, It begin, It end) - : name_(std::move(name)) - , sinks_(begin, end) {} + : name_(std::move(name)), + sinks_(begin, end) {} // Logger with single sink logger(std::string name, sink_ptr single_sink) diff --git a/include/spdlog/pattern_formatter-inl.h b/include/spdlog/pattern_formatter-inl.h index 44b48617..1592b49f 100644 --- a/include/spdlog/pattern_formatter-inl.h +++ b/include/spdlog/pattern_formatter-inl.h @@ -37,8 +37,8 @@ namespace details { class scoped_padder { public: scoped_padder(size_t wrapped_size, const padding_info &padinfo, memory_buf_t &dest) - : padinfo_(padinfo) - , dest_(dest) { + : padinfo_(padinfo), + dest_(dest) { remaining_pad_ = static_cast(padinfo.width_) - static_cast(wrapped_size); if (remaining_pad_ <= 0) { return; @@ -766,8 +766,8 @@ public: using DurationUnits = Units; explicit elapsed_formatter(padding_info padinfo) - : flag_formatter(padinfo) - , last_message_time_(log_clock::now()) {} + : flag_formatter(padinfo), + last_message_time_(log_clock::now()) {} void format(const details::log_msg &msg, const std::tm &, memory_buf_t &dest) override { auto delta = (std::max)(msg.time - last_message_time_, log_clock::duration::zero()); @@ -873,23 +873,23 @@ SPDLOG_INLINE pattern_formatter::pattern_formatter(std::string pattern, pattern_time_type time_type, std::string eol, custom_flags custom_user_flags) - : pattern_(std::move(pattern)) - , eol_(std::move(eol)) - , pattern_time_type_(time_type) - , need_localtime_(false) - , last_log_secs_(0) - , custom_handlers_(std::move(custom_user_flags)) { + : pattern_(std::move(pattern)), + eol_(std::move(eol)), + pattern_time_type_(time_type), + need_localtime_(false), + last_log_secs_(0), + custom_handlers_(std::move(custom_user_flags)) { std::memset(&cached_tm_, 0, sizeof(cached_tm_)); compile_pattern_(pattern_); } // use by default full formatter for if pattern is not given SPDLOG_INLINE pattern_formatter::pattern_formatter(pattern_time_type time_type, std::string eol) - : pattern_("%+") - , eol_(std::move(eol)) - , pattern_time_type_(time_type) - , need_localtime_(true) - , last_log_secs_(0) { + : pattern_("%+"), + eol_(std::move(eol)), + pattern_time_type_(time_type), + need_localtime_(true), + last_log_secs_(0) { std::memset(&cached_tm_, 0, sizeof(cached_tm_)); formatters_.push_back(details::make_unique(details::padding_info{})); } diff --git a/include/spdlog/pattern_formatter.h b/include/spdlog/pattern_formatter.h index a718b606..feceb891 100644 --- a/include/spdlog/pattern_formatter.h +++ b/include/spdlog/pattern_formatter.h @@ -25,10 +25,10 @@ struct padding_info { padding_info() = default; padding_info(size_t width, padding_info::pad_side side, bool truncate) - : width_(width) - , side_(side) - , truncate_(truncate) - , enabled_(true) {} + : width_(width), + side_(side), + truncate_(truncate), + enabled_(true) {} bool enabled() const { return enabled_; } size_t width_ = 0; diff --git a/include/spdlog/sinks/android_sink.h b/include/spdlog/sinks/android_sink.h index 7c6ca59b..b5245515 100644 --- a/include/spdlog/sinks/android_sink.h +++ b/include/spdlog/sinks/android_sink.h @@ -34,8 +34,8 @@ template class android_sink final : public base_sink { public: explicit android_sink(std::string tag = "spdlog", bool use_raw_msg = false) - : tag_(std::move(tag)) - , use_raw_msg_(use_raw_msg) {} + : tag_(std::move(tag)), + use_raw_msg_(use_raw_msg) {} protected: void sink_it_(const details::log_msg &msg) override { diff --git a/include/spdlog/sinks/ansicolor_sink-inl.h b/include/spdlog/sinks/ansicolor_sink-inl.h index ced3bdfb..8a94f818 100644 --- a/include/spdlog/sinks/ansicolor_sink-inl.h +++ b/include/spdlog/sinks/ansicolor_sink-inl.h @@ -15,9 +15,9 @@ namespace sinks { template SPDLOG_INLINE ansicolor_sink::ansicolor_sink(FILE *target_file, color_mode mode) - : target_file_(target_file) - , mutex_(ConsoleMutex::mutex()) - , formatter_(details::make_unique()) + : target_file_(target_file), + mutex_(ConsoleMutex::mutex()), + formatter_(details::make_unique()) { set_color_mode(mode); diff --git a/include/spdlog/sinks/daily_file_sink.h b/include/spdlog/sinks/daily_file_sink.h index 14b33a54..96c0fad8 100644 --- a/include/spdlog/sinks/daily_file_sink.h +++ b/include/spdlog/sinks/daily_file_sink.h @@ -73,13 +73,13 @@ public: bool truncate = false, uint16_t max_files = 0, const file_event_handlers &event_handlers = {}) - : base_filename_(std::move(base_filename)) - , rotation_h_(rotation_hour) - , rotation_m_(rotation_minute) - , file_helper_{event_handlers} - , truncate_(truncate) - , max_files_(max_files) - , filenames_q_() { + : base_filename_(std::move(base_filename)), + rotation_h_(rotation_hour), + rotation_m_(rotation_minute), + file_helper_{event_handlers}, + truncate_(truncate), + max_files_(max_files), + filenames_q_() { if (rotation_hour < 0 || rotation_hour > 23 || rotation_minute < 0 || rotation_minute > 59) { throw_spdlog_ex("daily_file_sink: Invalid rotation time in ctor"); diff --git a/include/spdlog/sinks/dup_filter_sink.h b/include/spdlog/sinks/dup_filter_sink.h index c2bc70c7..21e4b115 100644 --- a/include/spdlog/sinks/dup_filter_sink.h +++ b/include/spdlog/sinks/dup_filter_sink.h @@ -42,8 +42,8 @@ public: template explicit dup_filter_sink(std::chrono::duration max_skip_duration, level::level_enum notification_level = level::info) - : max_skip_duration_{max_skip_duration} - , log_level_{notification_level} {} + : max_skip_duration_{max_skip_duration}, + log_level_{notification_level} {} protected: std::chrono::microseconds max_skip_duration_; diff --git a/include/spdlog/sinks/hourly_file_sink.h b/include/spdlog/sinks/hourly_file_sink.h index 81dacc21..230d0d61 100644 --- a/include/spdlog/sinks/hourly_file_sink.h +++ b/include/spdlog/sinks/hourly_file_sink.h @@ -48,11 +48,11 @@ public: bool truncate = false, uint16_t max_files = 0, const file_event_handlers &event_handlers = {}) - : base_filename_(std::move(base_filename)) - , file_helper_{event_handlers} - , truncate_(truncate) - , max_files_(max_files) - , filenames_q_() { + : base_filename_(std::move(base_filename)), + file_helper_{event_handlers}, + truncate_(truncate), + max_files_(max_files), + filenames_q_() { auto now = log_clock::now(); auto filename = FileNameCalc::calc_filename(base_filename_, now_tm(now)); file_helper_.open(filename, truncate_); diff --git a/include/spdlog/sinks/kafka_sink.h b/include/spdlog/sinks/kafka_sink.h index 32ebdc93..d589449a 100644 --- a/include/spdlog/sinks/kafka_sink.h +++ b/include/spdlog/sinks/kafka_sink.h @@ -30,9 +30,9 @@ struct kafka_sink_config { int32_t flush_timeout_ms = 1000; kafka_sink_config(std::string addr, std::string topic, int flush_timeout_ms = 1000) - : server_addr{std::move(addr)} - , produce_topic{std::move(topic)} - , flush_timeout_ms(flush_timeout_ms) {} + : server_addr{std::move(addr)}, + produce_topic{std::move(topic)}, + flush_timeout_ms(flush_timeout_ms) {} }; template diff --git a/include/spdlog/sinks/mongo_sink.h b/include/spdlog/sinks/mongo_sink.h index 85a46952..f3327485 100644 --- a/include/spdlog/sinks/mongo_sink.h +++ b/include/spdlog/sinks/mongo_sink.h @@ -40,9 +40,9 @@ public: const std::string &db_name, const std::string &collection_name, const std::string &uri = "mongodb://localhost:27017") - : instance_(std::move(instance)) - , db_name_(db_name) - , coll_name_(collection_name) { + : instance_(std::move(instance)), + db_name_(db_name), + coll_name_(collection_name) { try { client_ = spdlog::details::make_unique(mongocxx::uri{uri}); } catch (const std::exception &e) { diff --git a/include/spdlog/sinks/ostream_sink.h b/include/spdlog/sinks/ostream_sink.h index 3c089ecf..46eadb5f 100644 --- a/include/spdlog/sinks/ostream_sink.h +++ b/include/spdlog/sinks/ostream_sink.h @@ -15,8 +15,8 @@ template class ostream_sink final : public base_sink { public: explicit ostream_sink(std::ostream &os, bool force_flush = false) - : ostream_(os) - , force_flush_(force_flush) {} + : ostream_(os), + force_flush_(force_flush) {} ostream_sink(const ostream_sink &) = delete; ostream_sink &operator=(const ostream_sink &) = delete; diff --git a/include/spdlog/sinks/qt_sinks.h b/include/spdlog/sinks/qt_sinks.h index d1cb8b6a..6423a8bc 100644 --- a/include/spdlog/sinks/qt_sinks.h +++ b/include/spdlog/sinks/qt_sinks.h @@ -30,8 +30,8 @@ template class qt_sink : public base_sink { public: qt_sink(QObject *qt_object, std::string meta_method) - : qt_object_(qt_object) - , meta_method_(std::move(meta_method)) { + : qt_object_(qt_object), + meta_method_(std::move(meta_method)) { if (!qt_object_) { throw_spdlog_ex("qt_sink: qt_object is null"); } @@ -69,9 +69,9 @@ public: int max_lines, bool dark_colors = false, bool is_utf8 = false) - : qt_text_edit_(qt_text_edit) - , max_lines_(max_lines) - , is_utf8_(is_utf8) { + : qt_text_edit_(qt_text_edit), + max_lines_(max_lines), + is_utf8_(is_utf8) { if (!qt_text_edit_) { throw_spdlog_ex("qt_color_text_sink: text_edit is null"); } @@ -131,13 +131,13 @@ protected: QTextCharFormat level_color, int color_range_start, int color_range_end) - : max_lines(max_lines) - , q_text_edit(q_text_edit) - , payload(std::move(payload)) - , default_color(default_color) - , level_color(level_color) - , color_range_start(color_range_start) - , color_range_end(color_range_end) {} + : max_lines(max_lines), + q_text_edit(q_text_edit), + payload(std::move(payload)), + default_color(default_color), + level_color(level_color), + color_range_start(color_range_start), + color_range_end(color_range_end) {} int max_lines; QTextEdit *q_text_edit; QString payload; diff --git a/include/spdlog/sinks/rotating_file_sink-inl.h b/include/spdlog/sinks/rotating_file_sink-inl.h index 1696f91f..f6f3b52e 100644 --- a/include/spdlog/sinks/rotating_file_sink-inl.h +++ b/include/spdlog/sinks/rotating_file_sink-inl.h @@ -30,10 +30,10 @@ rotating_file_sink::rotating_file_sink(filename_t base_filename, std::size_t max_files, bool rotate_on_open, const file_event_handlers &event_handlers) - : base_filename_(std::move(base_filename)) - , max_size_(max_size) - , max_files_(max_files) - , file_helper_{event_handlers} { + : base_filename_(std::move(base_filename)), + max_size_(max_size), + max_files_(max_files), + file_helper_{event_handlers} { if (max_size == 0) { throw_spdlog_ex("rotating sink constructor: max_size arg cannot be zero"); } diff --git a/include/spdlog/sinks/stdout_sinks-inl.h b/include/spdlog/sinks/stdout_sinks-inl.h index 0a8ef67f..e8b98b69 100644 --- a/include/spdlog/sinks/stdout_sinks-inl.h +++ b/include/spdlog/sinks/stdout_sinks-inl.h @@ -30,9 +30,9 @@ namespace sinks { template SPDLOG_INLINE stdout_sink_base::stdout_sink_base(FILE *file) - : mutex_(ConsoleMutex::mutex()) - , file_(file) - , formatter_(details::make_unique()) { + : mutex_(ConsoleMutex::mutex()), + file_(file), + formatter_(details::make_unique()) { #ifdef _WIN32 // get windows handle from the FILE* object diff --git a/include/spdlog/sinks/syslog_sink.h b/include/spdlog/sinks/syslog_sink.h index 5bd01418..6f47076c 100644 --- a/include/spdlog/sinks/syslog_sink.h +++ b/include/spdlog/sinks/syslog_sink.h @@ -21,15 +21,15 @@ class syslog_sink : public base_sink { public: syslog_sink(std::string ident, int syslog_option, int syslog_facility, bool enable_formatting) - : enable_formatting_{enable_formatting} - , syslog_levels_{{/* spdlog::level::trace */ LOG_DEBUG, + : enable_formatting_{enable_formatting}, + syslog_levels_{{/* spdlog::level::trace */ LOG_DEBUG, /* spdlog::level::debug */ LOG_DEBUG, /* spdlog::level::info */ LOG_INFO, /* spdlog::level::warn */ LOG_WARNING, /* spdlog::level::err */ LOG_ERR, /* spdlog::level::critical */ LOG_CRIT, - /* spdlog::level::off */ LOG_INFO}} - , ident_{std::move(ident)} { + /* spdlog::level::off */ LOG_INFO}}, + ident_{std::move(ident)} { // set ident to be program name if empty ::openlog(ident_.empty() ? nullptr : ident_.c_str(), syslog_option, syslog_facility); } diff --git a/include/spdlog/sinks/systemd_sink.h b/include/spdlog/sinks/systemd_sink.h index 45396b3c..aa0d1046 100644 --- a/include/spdlog/sinks/systemd_sink.h +++ b/include/spdlog/sinks/systemd_sink.h @@ -24,9 +24,9 @@ template class systemd_sink : public base_sink { public: systemd_sink(std::string ident = "", bool enable_formatting = false) - : ident_{std::move(ident)} - , enable_formatting_{enable_formatting} - , syslog_levels_{{/* spdlog::level::trace */ LOG_DEBUG, + : ident_{std::move(ident)}, + enable_formatting_{enable_formatting}, + syslog_levels_{{/* spdlog::level::trace */ LOG_DEBUG, /* spdlog::level::debug */ LOG_DEBUG, /* spdlog::level::info */ LOG_INFO, /* spdlog::level::warn */ LOG_WARNING, diff --git a/include/spdlog/sinks/tcp_sink.h b/include/spdlog/sinks/tcp_sink.h index c7830cf7..8ce4ff05 100644 --- a/include/spdlog/sinks/tcp_sink.h +++ b/include/spdlog/sinks/tcp_sink.h @@ -34,8 +34,8 @@ struct tcp_sink_config { bool lazy_connect = false; // if true connect on first log call instead of on construction tcp_sink_config(std::string host, int port) - : server_host{std::move(host)} - , server_port{port} {} + : server_host{std::move(host)}, + server_port{port} {} }; template diff --git a/include/spdlog/sinks/udp_sink.h b/include/spdlog/sinks/udp_sink.h index 5c37aad1..d2c5351d 100644 --- a/include/spdlog/sinks/udp_sink.h +++ b/include/spdlog/sinks/udp_sink.h @@ -28,8 +28,8 @@ struct udp_sink_config { uint16_t server_port; udp_sink_config(std::string host, uint16_t port) - : server_host{std::move(host)} - , server_port{port} {} + : server_host{std::move(host)}, + server_port{port} {} }; template diff --git a/include/spdlog/sinks/win_eventlog_sink.h b/include/spdlog/sinks/win_eventlog_sink.h index 19663d2f..09f3aa38 100644 --- a/include/spdlog/sinks/win_eventlog_sink.h +++ b/include/spdlog/sinks/win_eventlog_sink.h @@ -236,8 +236,8 @@ protected: public: win_eventlog_sink(std::string const &source, DWORD event_id = 1000 /* according to mscoree.dll */) - : source_(source) - , event_id_(event_id) { + : source_(source), + event_id_(event_id) { try { current_user_sid_ = internal::sid_t::get_current_user_sid(); } catch (...) { diff --git a/include/spdlog/sinks/wincolor_sink-inl.h b/include/spdlog/sinks/wincolor_sink-inl.h index 5f66d36d..4db7c45e 100644 --- a/include/spdlog/sinks/wincolor_sink-inl.h +++ b/include/spdlog/sinks/wincolor_sink-inl.h @@ -17,9 +17,9 @@ namespace spdlog { namespace sinks { template SPDLOG_INLINE wincolor_sink::wincolor_sink(void *out_handle, color_mode mode) - : out_handle_(out_handle) - , mutex_(ConsoleMutex::mutex()) - , formatter_(details::make_unique()) { + : out_handle_(out_handle), + mutex_(ConsoleMutex::mutex()), + formatter_(details::make_unique()) { set_color_mode_impl(mode); // set level colors