Function log_

Synopsis

#include <include/spdlog/logger.h>

template <typename FormatString, typename... Args>
void log_(source_loc loc, level::level_enum lvl, const FormatString &fmt, Args &&...args)

Description

common implementation for after templated public api has been resolved

Source

Lines 329-346 in include/spdlog/logger.h.

template<typename FormatString, typename... Args>
void log_(source_loc loc, level::level_enum lvl, const FormatString &fmt, Args &&...args)
{
    bool log_enabled = should_log(lvl);
    bool traceback_enabled = tracer_.enabled();
    if (!log_enabled && !traceback_enabled)
    {
        return;
    }
    SPDLOG_TRY
    {
        memory_buf_t buf;
        fmt::format_to(buf, fmt, std::forward<Args>(args)...);
        details::log_msg log_msg(loc, name_, lvl, string_view_t(buf.data(), buf.size()));
        log_it_(log_msg, log_enabled, traceback_enabled);
    }
    SPDLOG_LOGGER_CATCH()
}





Add Discussion

Log in to comment