1
0
mirror of https://github.com/gabime/spdlog.git synced 2025-04-01 02:42:41 +08:00

check should_log in log_with_format_

This commit is contained in:
gabime 2023-09-08 16:56:39 +03:00
parent f755cfc0e7
commit ac6b7ec87e

View File

@ -79,10 +79,14 @@ public:
template<typename... Args> template<typename... Args>
void log(source_loc loc, level::level_enum lvl, format_string_t<Args...> fmt, Args &&...args) void log(source_loc loc, level::level_enum lvl, format_string_t<Args...> fmt, Args &&...args)
{
if (should_log(lvl))
{ {
log_with_format_(loc, lvl, details::to_string_view(fmt), std::forward<Args>(args)...); log_with_format_(loc, lvl, details::to_string_view(fmt), std::forward<Args>(args)...);
} }
}
template<typename... Args> template<typename... Args>
void log(level::level_enum lvl, format_string_t<Args...> fmt, Args &&...args) void log(level::level_enum lvl, format_string_t<Args...> fmt, Args &&...args)
{ {
@ -247,10 +251,7 @@ protected:
template<typename... Args> template<typename... Args>
void log_with_format_(source_loc loc, level::level_enum lvl, string_view_t fmt, Args &&...args) void log_with_format_(source_loc loc, level::level_enum lvl, string_view_t fmt, Args &&...args)
{ {
if (!should_log(lvl)) assert(should_log(lvl));
{
return;
}
SPDLOG_TRY SPDLOG_TRY
{ {
memory_buf_t buf; memory_buf_t buf;