|
|
@ -76,7 +76,9 @@ public:
|
|
|
|
template<typename... Args>
|
|
|
|
template<typename... Args>
|
|
|
|
void log(source_loc loc, level::level_enum lvl, string_view_t fmt, const Args &... args)
|
|
|
|
void log(source_loc loc, level::level_enum lvl, string_view_t fmt, const Args &... args)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (!should_log(lvl) && !tracer_.enabled())
|
|
|
|
bool log_enabled = should_log(lvl);
|
|
|
|
|
|
|
|
bool traceback_enabled = tracer_.enabled();
|
|
|
|
|
|
|
|
if (!log_enabled && !traceback_enabled)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -85,7 +87,7 @@ public:
|
|
|
|
memory_buf_t buf;
|
|
|
|
memory_buf_t buf;
|
|
|
|
fmt::format_to(buf, fmt, args...);
|
|
|
|
fmt::format_to(buf, fmt, args...);
|
|
|
|
details::log_msg log_msg(loc, name_, lvl, string_view_t(buf.data(), buf.size()));
|
|
|
|
details::log_msg log_msg(loc, name_, lvl, string_view_t(buf.data(), buf.size()));
|
|
|
|
log_it_(log_msg);
|
|
|
|
log_it_(log_msg, log_enabled, traceback_enabled);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
SPDLOG_LOGGER_CATCH()
|
|
|
|
SPDLOG_LOGGER_CATCH()
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -142,13 +144,15 @@ public:
|
|
|
|
template<class T, typename std::enable_if<std::is_convertible<const T &, spdlog::string_view_t>::value, T>::type * = nullptr>
|
|
|
|
template<class T, typename std::enable_if<std::is_convertible<const T &, spdlog::string_view_t>::value, T>::type * = nullptr>
|
|
|
|
void log(source_loc loc, level::level_enum lvl, const T &msg)
|
|
|
|
void log(source_loc loc, level::level_enum lvl, const T &msg)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (!should_log(lvl) && !tracer_.enabled())
|
|
|
|
bool log_enabled = should_log(lvl);
|
|
|
|
|
|
|
|
bool traceback_enabled = tracer_.enabled();
|
|
|
|
|
|
|
|
if (!log_enabled && !traceback_enabled)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
details::log_msg log_msg(loc, name_, lvl, msg);
|
|
|
|
details::log_msg log_msg(loc, name_, lvl, msg);
|
|
|
|
log_it_(log_msg);
|
|
|
|
log_it_(log_msg, log_enabled, traceback_enabled);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void log(level::level_enum lvl, string_view_t msg)
|
|
|
|
void log(level::level_enum lvl, string_view_t msg)
|
|
|
@ -209,7 +213,9 @@ public:
|
|
|
|
template<typename... Args>
|
|
|
|
template<typename... Args>
|
|
|
|
void log(source_loc loc, level::level_enum lvl, wstring_view_t fmt, const Args &... args)
|
|
|
|
void log(source_loc loc, level::level_enum lvl, wstring_view_t fmt, const Args &... args)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (!should_log(lvl) && !tracer_.enabled())
|
|
|
|
bool log_enabled = should_log(lvl);
|
|
|
|
|
|
|
|
bool traceback_enabled = tracer_.enabled();
|
|
|
|
|
|
|
|
if (!log_enabled && !traceback_enabled)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -222,7 +228,7 @@ public:
|
|
|
|
memory_buf_t buf;
|
|
|
|
memory_buf_t buf;
|
|
|
|
details::os::wstr_to_utf8buf(wstring_view_t(wbuf.data(), wbuf.size()), buf);
|
|
|
|
details::os::wstr_to_utf8buf(wstring_view_t(wbuf.data(), wbuf.size()), buf);
|
|
|
|
details::log_msg log_msg(loc, name_, lvl, string_view_t(buf.data(), buf.size()));
|
|
|
|
details::log_msg log_msg(loc, name_, lvl, string_view_t(buf.data(), buf.size()));
|
|
|
|
log_it_(log_msg);
|
|
|
|
log_it_(log_msg, log_enabled, traceback_enabled);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
SPDLOG_LOGGER_CATCH()
|
|
|
|
SPDLOG_LOGGER_CATCH()
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -273,7 +279,9 @@ public:
|
|
|
|
template<class T, typename std::enable_if<is_convertible_to_wstring_view<const T &>::value, T>::type * = nullptr>
|
|
|
|
template<class T, typename std::enable_if<is_convertible_to_wstring_view<const T &>::value, T>::type * = nullptr>
|
|
|
|
void log(source_loc loc, level::level_enum lvl, const T &msg)
|
|
|
|
void log(source_loc loc, level::level_enum lvl, const T &msg)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (!should_log(lvl) && !tracer_.enabled())
|
|
|
|
bool log_enabled = should_log(lvl);
|
|
|
|
|
|
|
|
bool traceback_enabled = tracer_.enabled();
|
|
|
|
|
|
|
|
if (!log_enabled && !traceback_enabled)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -283,7 +291,7 @@ public:
|
|
|
|
memory_buf_t buf;
|
|
|
|
memory_buf_t buf;
|
|
|
|
details::os::wstr_to_utf8buf(msg, buf);
|
|
|
|
details::os::wstr_to_utf8buf(msg, buf);
|
|
|
|
details::log_msg log_msg(loc, name_, lvl, string_view_t(buf.data(), buf.size()));
|
|
|
|
details::log_msg log_msg(loc, name_, lvl, string_view_t(buf.data(), buf.size()));
|
|
|
|
log_it_(log_msg);
|
|
|
|
log_it_(log_msg, log_enabled, traceback_enabled);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
SPDLOG_LOGGER_CATCH()
|
|
|
|
SPDLOG_LOGGER_CATCH()
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -340,7 +348,7 @@ protected:
|
|
|
|
|
|
|
|
|
|
|
|
// log the given message (if the given log level is high enough),
|
|
|
|
// log the given message (if the given log level is high enough),
|
|
|
|
// and save backtrace (if backtrace is enabled).
|
|
|
|
// and save backtrace (if backtrace is enabled).
|
|
|
|
void log_it_(const details::log_msg &log_msg);
|
|
|
|
void log_it_(const details::log_msg &log_msg, bool log_enabled, bool traceback_enabled);
|
|
|
|
virtual void sink_it_(const details::log_msg &msg);
|
|
|
|
virtual void sink_it_(const details::log_msg &msg);
|
|
|
|
virtual void flush_();
|
|
|
|
virtual void flush_();
|
|
|
|
void dump_backtrace_();
|
|
|
|
void dump_backtrace_();
|
|
|
|