Simplified code

This commit is contained in:
gabime 2023-07-28 17:37:19 +03:00
parent 92daf6954b
commit 2ecc00e9c6

View File

@ -103,25 +103,18 @@ public:
void log(log_clock::time_point log_time, source_loc loc, level::level_enum lvl, string_view_t msg)
{
bool log_enabled = should_log(lvl);
if (!log_enabled)
if(should_log(lvl))
{
return;
sink_it_(details::log_msg(log_time, loc, name_, lvl, msg));
}
details::log_msg log_msg(log_time, loc, name_, lvl, msg);
sink_it_(log_msg);
}
void log(source_loc loc, level::level_enum lvl, string_view_t msg)
{
bool log_enabled = should_log(lvl);
if (!log_enabled)
if(should_log(lvl))
{
return;
sink_it_(details::log_msg(loc, name_, lvl, msg));
}
sink_it_(details::log_msg(loc, name_, lvl, msg));
}
void log(level::level_enum lvl, string_view_t msg)
@ -202,6 +195,7 @@ public:
}
// return true logging is enabled for the given level.
[[nodiscard]]
bool should_log(level::level_enum msg_level) const
{
return msg_level >= level_.load(std::memory_order_relaxed);