|
|
|
@ -23,7 +23,10 @@ inline spdlog::logger::logger(const std::string& logger_name, const It& begin, c
|
|
|
|
|
_level = level::info;
|
|
|
|
|
_flush_level = level::off;
|
|
|
|
|
_last_err_time = 0;
|
|
|
|
|
_err_handler = [this](const std::string &msg) { this->_default_err_handler(msg);};
|
|
|
|
|
_err_handler = [this](const std::string &msg)
|
|
|
|
|
{
|
|
|
|
|
this->_default_err_handler(msg);
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ctor with sinks as init list
|
|
|
|
@ -60,15 +63,18 @@ inline void spdlog::logger::log(level::level_enum lvl, const char* fmt, const Ar
|
|
|
|
|
{
|
|
|
|
|
if (!should_log(lvl)) return;
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
details::log_msg log_msg(&_name, lvl);
|
|
|
|
|
log_msg.raw.write(fmt, args...);
|
|
|
|
|
_sink_it(log_msg);
|
|
|
|
|
}
|
|
|
|
|
catch (const std::exception &ex) {
|
|
|
|
|
catch (const std::exception &ex)
|
|
|
|
|
{
|
|
|
|
|
_err_handler(ex.what());
|
|
|
|
|
}
|
|
|
|
|
catch (...) {
|
|
|
|
|
catch (...)
|
|
|
|
|
{
|
|
|
|
|
_err_handler("Unknown exception");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -77,15 +83,18 @@ template <typename... Args>
|
|
|
|
|
inline void spdlog::logger::log(level::level_enum lvl, const char* msg)
|
|
|
|
|
{
|
|
|
|
|
if (!should_log(lvl)) return;
|
|
|
|
|
try {
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
details::log_msg log_msg(&_name, lvl);
|
|
|
|
|
log_msg.raw << msg;
|
|
|
|
|
_sink_it(log_msg);
|
|
|
|
|
}
|
|
|
|
|
catch (const std::exception &ex) {
|
|
|
|
|
catch (const std::exception &ex)
|
|
|
|
|
{
|
|
|
|
|
_err_handler(ex.what());
|
|
|
|
|
}
|
|
|
|
|
catch (...) {
|
|
|
|
|
catch (...)
|
|
|
|
|
{
|
|
|
|
|
_err_handler("Unknown exception");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -95,15 +104,18 @@ template<typename T>
|
|
|
|
|
inline void spdlog::logger::log(level::level_enum lvl, const T& msg)
|
|
|
|
|
{
|
|
|
|
|
if (!should_log(lvl)) return;
|
|
|
|
|
try {
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
details::log_msg log_msg(&_name, lvl);
|
|
|
|
|
log_msg.raw << msg;
|
|
|
|
|
_sink_it(log_msg);
|
|
|
|
|
}
|
|
|
|
|
catch (const std::exception &ex) {
|
|
|
|
|
catch (const std::exception &ex)
|
|
|
|
|
{
|
|
|
|
|
_err_handler(ex.what());
|
|
|
|
|
}
|
|
|
|
|
catch (...) {
|
|
|
|
|
catch (...)
|
|
|
|
|
{
|
|
|
|
|
_err_handler("Unknown exception");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|