From 75b8fe9fafea6f0a33208c0da326cdbbfab08568 Mon Sep 17 00:00:00 2001 From: Mohammad Ali Date: Tue, 17 Jan 2023 00:18:57 +0330 Subject: [PATCH] fix problem in initializing the custom_log_callbacks struct it was an ordering problem --- example/example.cpp | 4 ++-- include/spdlog/sinks/callback_sink.h | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/example/example.cpp b/example/example.cpp index e0d78c96..b273c451 100644 --- a/example/example.cpp +++ b/example/example.cpp @@ -143,10 +143,10 @@ void callback_example() { // Define the callbacks spdlog::custom_log_callbacks callbacks; - callbacks.on_log_formatted = [](std::string str){ + callbacks.on_log_formatted = [](std::string /*str*/){ // do what you need to do with str }; - callbacks.on_log = [](spdlog::details::log_msg msg){ + callbacks.on_log = [](spdlog::details::log_msg /*msg*/){ // do what you need to do with msg }; diff --git a/include/spdlog/sinks/callback_sink.h b/include/spdlog/sinks/callback_sink.h index c6327e0f..68c82864 100644 --- a/include/spdlog/sinks/callback_sink.h +++ b/include/spdlog/sinks/callback_sink.h @@ -15,14 +15,13 @@ namespace spdlog { // callbacks struct struct custom_log_callbacks { - custom_log_callbacks() : on_log(nullptr) , on_log_formatted(nullptr) {} - std::function on_log_formatted; std::function on_log; + std::function on_log_formatted; }; namespace sinks {