mirror of
https://github.com/gabime/spdlog.git
synced 2025-09-29 01:29:35 +08:00
Removed all *_if functions (trace_if, debug_if, info_if,..) because they are redundant and confusing way to preform if
This commit is contained in:
@@ -153,78 +153,6 @@ inline void spdlog::logger::critical(const char* fmt, const Arg1 &arg1, const Ar
|
||||
log(level::critical, fmt, arg1, args...);
|
||||
}
|
||||
|
||||
template <typename... Args>
|
||||
inline void spdlog::logger::log_if(const bool flag, level::level_enum lvl, const char* msg)
|
||||
{
|
||||
if (flag)
|
||||
{
|
||||
log(lvl, msg);
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
inline void spdlog::logger::log_if(const bool flag, level::level_enum lvl, const T& msg)
|
||||
{
|
||||
if (flag)
|
||||
{
|
||||
log(lvl, msg);
|
||||
}
|
||||
}
|
||||
|
||||
template <typename Arg1, typename... Args>
|
||||
inline void spdlog::logger::trace_if(const bool flag, const char* fmt, const Arg1 &arg1, const Args&... args)
|
||||
{
|
||||
if (flag)
|
||||
{
|
||||
log(level::trace, fmt, arg1, args...);
|
||||
}
|
||||
}
|
||||
|
||||
template <typename Arg1, typename... Args>
|
||||
inline void spdlog::logger::debug_if(const bool flag, const char* fmt, const Arg1 &arg1, const Args&... args)
|
||||
{
|
||||
if (flag)
|
||||
{
|
||||
log(level::debug, fmt, arg1, args...);
|
||||
}
|
||||
}
|
||||
|
||||
template <typename Arg1, typename... Args>
|
||||
inline void spdlog::logger::info_if(const bool flag, const char* fmt, const Arg1 &arg1, const Args&... args)
|
||||
{
|
||||
if (flag)
|
||||
{
|
||||
log(level::info, fmt, arg1, args...);
|
||||
}
|
||||
}
|
||||
|
||||
template <typename Arg1, typename... Args>
|
||||
inline void spdlog::logger::warn_if(const bool flag, const char* fmt, const Arg1& arg1, const Args&... args)
|
||||
{
|
||||
if (flag)
|
||||
{
|
||||
log(level::warn, fmt, arg1, args...);
|
||||
}
|
||||
}
|
||||
|
||||
template <typename Arg1, typename... Args>
|
||||
inline void spdlog::logger::error_if(const bool flag, const char* fmt, const Arg1 &arg1, const Args&... args)
|
||||
{
|
||||
if (flag)
|
||||
{
|
||||
log(level::err, fmt, arg1, args...);
|
||||
}
|
||||
}
|
||||
|
||||
template <typename Arg1, typename... Args>
|
||||
inline void spdlog::logger::critical_if(const bool flag, const char* fmt, const Arg1 &arg1, const Args&... args)
|
||||
{
|
||||
if (flag)
|
||||
{
|
||||
log(level::critical, fmt, arg1, args...);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<typename T>
|
||||
inline void spdlog::logger::trace(const T& msg)
|
||||
@@ -264,59 +192,6 @@ inline void spdlog::logger::critical(const T& msg)
|
||||
log(level::critical, msg);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
inline void spdlog::logger::trace_if(const bool flag, const T& msg)
|
||||
{
|
||||
if (flag)
|
||||
{
|
||||
log(level::trace, msg);
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
inline void spdlog::logger::debug_if(const bool flag, const T& msg)
|
||||
{
|
||||
if (flag)
|
||||
{
|
||||
log(level::debug, msg);
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
inline void spdlog::logger::info_if(const bool flag, const T& msg)
|
||||
{
|
||||
if (flag)
|
||||
{
|
||||
log(level::info, msg);
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
inline void spdlog::logger::warn_if(const bool flag, const T& msg)
|
||||
{
|
||||
if (flag)
|
||||
{
|
||||
log(level::warn, msg);
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
inline void spdlog::logger::error_if(const bool flag, const T& msg)
|
||||
{
|
||||
if (flag)
|
||||
{
|
||||
log(level::err, msg);
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
inline void spdlog::logger::critical_if(const bool flag, const T& msg)
|
||||
{
|
||||
if (flag)
|
||||
{
|
||||
log(level::critical, msg);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#ifdef SPDLOG_WCHAR_TO_UTF8_SUPPORT
|
||||
@@ -377,81 +252,6 @@ inline void spdlog::logger::critical(const wchar_t* fmt, const Args&... args)
|
||||
log(level::critical, fmt, args...);
|
||||
}
|
||||
|
||||
//
|
||||
// conditional logging
|
||||
//
|
||||
|
||||
template <typename... Args>
|
||||
inline void spdlog::logger::log_if(const bool flag, level::level_enum lvl, const wchar_t* msg)
|
||||
{
|
||||
if (flag)
|
||||
{
|
||||
log(lvl, msg);
|
||||
}
|
||||
}
|
||||
|
||||
template <typename... Args>
|
||||
inline void spdlog::logger::log_if(const bool flag, level::level_enum lvl, const wchar_t* fmt, const Args&... args)
|
||||
{
|
||||
if (flag)
|
||||
{
|
||||
log(lvl, fmt, args...);
|
||||
}
|
||||
}
|
||||
|
||||
template <typename... Args>
|
||||
inline void spdlog::logger::trace_if(const bool flag, const wchar_t* fmt, const Args&... args)
|
||||
{
|
||||
if (flag)
|
||||
{
|
||||
log(level::trace, fmt, args...);
|
||||
}
|
||||
}
|
||||
|
||||
template <typename... Args>
|
||||
inline void spdlog::logger::debug_if(const bool flag, const wchar_t* fmt, const Args&... args)
|
||||
{
|
||||
if (flag)
|
||||
{
|
||||
log(level::debug, fmt, args...);
|
||||
}
|
||||
}
|
||||
|
||||
template <typename... Args>
|
||||
inline void spdlog::logger::info_if(const bool flag, const wchar_t* fmt, const Args&... args)
|
||||
{
|
||||
if (flag)
|
||||
{
|
||||
log(level::info, fmt, args...);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template <typename... Args>
|
||||
inline void spdlog::logger::warn_if(const bool flag, const wchar_t* fmt, const Args&... args)
|
||||
{
|
||||
if (flag)
|
||||
{
|
||||
log(level::warn, fmt, args...);
|
||||
}
|
||||
}
|
||||
|
||||
template <typename... Args>
|
||||
inline void spdlog::logger::error_if(const bool flag, const wchar_t* fmt, const Args&... args)
|
||||
{
|
||||
if (flag)
|
||||
{
|
||||
log(level::err, fmt, args...);
|
||||
}
|
||||
}
|
||||
|
||||
template <typename... Args>
|
||||
inline void spdlog::logger::critical_if(const bool flag, const wchar_t* fmt, const Args&... args)
|
||||
{
|
||||
if (flag)
|
||||
{
|
||||
log(level::critical, fmt, args...);
|
||||
}
|
||||
}
|
||||
|
||||
#endif // SPDLOG_WCHAR_TO_UTF8_SUPPORT
|
||||
|
Reference in New Issue
Block a user