From b1eb4953faa270a0810b41343c2fede5bab87293 Mon Sep 17 00:00:00 2001 From: gabime Date: Sat, 17 Jun 2023 18:30:13 +0300 Subject: [PATCH] Cleaned some warnings in qt_sinks --- include/spdlog/sinks/qt_sinks.h | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/include/spdlog/sinks/qt_sinks.h b/include/spdlog/sinks/qt_sinks.h index 670daa21..ebfed022 100644 --- a/include/spdlog/sinks/qt_sinks.h +++ b/include/spdlog/sinks/qt_sinks.h @@ -30,10 +30,13 @@ template class qt_sink : public base_sink { public: - qt_sink(QObject *qt_object, const std::string &meta_method) + 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_ = meta_method; + if (!qt_object_) + { + throw_spdlog_ex("qt_sink: qt_object is null"); + } + } ~qt_sink() @@ -150,10 +153,9 @@ private: int color_range_start; int color_range_end; }; + void sink_it_(const details::log_msg &msg) override { - - using this_type = qt_color_sink; memory_buf_t formatted; base_sink::formatter_->format(msg, formatted); @@ -226,6 +228,7 @@ private: #include "spdlog/details/null_mutex.h" #include + using qt_sink_mt = qt_sink; using qt_sink_st = qt_sink; using qt_color_sink_mt = qt_color_sink;