fix problem in initializing the custom_log_callbacks struct

it was an ordering problem
pull/2610/head
Mohammad Ali 3 years ago
parent 602510e27c
commit 75b8fe9faf

@ -143,10 +143,10 @@ void callback_example()
{ {
// Define the callbacks // Define the callbacks
spdlog::custom_log_callbacks 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 // 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 // do what you need to do with msg
}; };

@ -15,14 +15,13 @@ namespace spdlog {
// callbacks struct // callbacks struct
struct custom_log_callbacks struct custom_log_callbacks
{ {
custom_log_callbacks() custom_log_callbacks()
: on_log(nullptr) : on_log(nullptr)
, on_log_formatted(nullptr) , on_log_formatted(nullptr)
{} {}
std::function<void(const std::string &mag_str)> on_log_formatted;
std::function<void(const details::log_msg &msg)> on_log; std::function<void(const details::log_msg &msg)> on_log;
std::function<void(const std::string &mag_str)> on_log_formatted;
}; };
namespace sinks { namespace sinks {

Loading…
Cancel
Save