Removed SPDLOG_LOGGER_CATCH macro

pull/3309/head
gabime 8 months ago
parent 0fd3e80794
commit 9df63cee2a

@ -23,14 +23,6 @@
#include "details/error_handler.h" #include "details/error_handler.h"
#include "sinks/sink.h" #include "sinks/sink.h"
#define SPDLOG_LOGGER_CATCH(location) \
catch (const std::exception &ex) { \
err_handler_.handle(location, ex.what()); \
} \
catch (...) { \
err_handler_.handle(location, "Unknown exception"); \
}
namespace spdlog { namespace spdlog {
class SPDLOG_API logger { class SPDLOG_API logger {
@ -185,7 +177,12 @@ private:
fmt::vformat_to(std::back_inserter(buf), format_string, fmt::make_format_args(args...)); fmt::vformat_to(std::back_inserter(buf), format_string, fmt::make_format_args(args...));
sink_it_(details::log_msg(loc, name_, lvl, string_view_t(buf.data(), buf.size()))); sink_it_(details::log_msg(loc, name_, lvl, string_view_t(buf.data(), buf.size())));
} }
SPDLOG_LOGGER_CATCH(loc) catch (const std::exception &ex) { \
err_handler_.handle(loc, ex.what()); \
} \
catch (...) { \
err_handler_.handle(loc, "Unknown exception"); \
}
} }
// log the given message (if the given log level is high enough) // log the given message (if the given log level is high enough)
@ -196,7 +193,12 @@ private:
try { try {
sink->log(msg); sink->log(msg);
} }
SPDLOG_LOGGER_CATCH(msg.source) catch (const std::exception &ex) { \
err_handler_.handle(msg.source, ex.what()); \
} \
catch (...) { \
err_handler_.handle(msg.source, "Unknown exception"); \
}
} }
} }

@ -79,7 +79,12 @@ void logger::flush_() {
try { try {
sink->flush(); sink->flush();
} }
SPDLOG_LOGGER_CATCH(source_loc{}) catch (const std::exception &ex) { \
err_handler_.handle(source_loc{}, ex.what()); \
} \
catch (...) { \
err_handler_.handle(source_loc{}, "Unknown exception"); \
}
} }
} }

Loading…
Cancel
Save