null_atomic_log_level and fix compile

This commit is contained in:
gabime
2023-09-23 00:27:32 +03:00
parent ac2955cb48
commit 392917f855
45 changed files with 365 additions and 365 deletions

View File

@@ -59,16 +59,16 @@ SPDLOG_API void set_formatter(std::unique_ptr<spdlog::formatter> formatter);
SPDLOG_API void set_pattern(std::string pattern, pattern_time_type time_type = pattern_time_type::local);
// Get global logging level
SPDLOG_API level::level_enum get_level();
SPDLOG_API log_level get_level();
// Set global logging level
SPDLOG_API void set_level(level::level_enum log_level);
SPDLOG_API void set_level(log_level log_level);
// Determine whether the default logger should log messages with a certain level
SPDLOG_API bool should_log(level::level_enum lvl);
SPDLOG_API bool should_log(log_level lvl);
// Set global flush level
SPDLOG_API void flush_on(level::level_enum log_level);
SPDLOG_API void flush_on(log_level log_level);
// Start/Restart a periodic flusher thread
// Warning: Use only if all your loggers are thread safe!
@@ -132,25 +132,25 @@ SPDLOG_API void set_default_logger(std::shared_ptr<spdlog::logger> default_logge
SPDLOG_API void apply_logger_env_levels(std::shared_ptr<logger> logger);
template<typename... Args>
inline void log(source_loc source, level::level_enum lvl, format_string_t<Args...> fmt, Args &&...args)
inline void log(source_loc source, log_level lvl, format_string_t<Args...> fmt, Args &&...args)
{
default_logger_raw()->log(source, lvl, fmt, std::forward<Args>(args)...);
}
template<typename... Args>
inline void log(level::level_enum lvl, format_string_t<Args...> fmt, Args &&...args)
inline void log(log_level lvl, format_string_t<Args...> fmt, Args &&...args)
{
default_logger_raw()->log(lvl, fmt, std::forward<Args>(args)...);
}
template<typename S, typename = is_convertible_to_sv<S>, typename... Args>
inline void log(source_loc loc, level::level_enum lvl, S fmt, Args &&...args)
inline void log(source_loc loc, log_level lvl, S fmt, Args &&...args)
{
default_logger_raw()->log(loc, lvl, fmt, std::forward<Args>(args)...);
}
template<typename S, typename = is_convertible_to_sv<S>, typename... Args>
inline void log(level::level_enum lvl, S fmt, Args &&...args)
inline void log(log_level lvl, S fmt, Args &&...args)
{
default_logger_raw()->log(lvl, fmt, std::forward<Args>(args)...);
}
@@ -159,135 +159,135 @@ inline void log(level::level_enum lvl, S fmt, Args &&...args)
template<typename... Args>
inline void trace(loc_with_fmt fmt, Args &&...args)
{
log(fmt.loc, level::trace, fmt.fmt_string, std::forward<Args>(args)...);
log(fmt.loc, log_level::trace, fmt.fmt_string, std::forward<Args>(args)...);
}
template<typename... Args>
inline void debug(loc_with_fmt fmt, Args &&...args)
{
log(fmt.loc, level::debug, fmt.fmt_string, std::forward<Args>(args)...);
log(fmt.loc, log_level::debug, fmt.fmt_string, std::forward<Args>(args)...);
}
template<typename... Args>
inline void info(loc_with_fmt fmt, Args &&...args)
{
log(fmt.loc, level::info, fmt.fmt_string, std::forward<Args>(args)...);
log(fmt.loc, log_level::info, fmt.fmt_string, std::forward<Args>(args)...);
}
template<typename... Args>
inline void warn(loc_with_fmt fmt, Args &&...args)
{
log(fmt.loc, level::warn, fmt.fmt_string, std::forward<Args>(args)...);
log(fmt.loc, spdlog::log_level::warn, fmt.fmt_string, std::forward<Args>(args)...);
}
template<typename... Args>
inline void error(loc_with_fmt fmt, Args &&...args)
{
log(fmt.loc, level::err, fmt.fmt_string, std::forward<Args>(args)...);
log(fmt.loc, log_level::err, fmt.fmt_string, std::forward<Args>(args)...);
}
template<typename... Args>
inline void critical(loc_with_fmt fmt, Args &&...args)
{
log(fmt.loc, level::critical, fmt.fmt_string, std::forward<Args>(args)...);
log(fmt.loc, log_level::critical, fmt.fmt_string, std::forward<Args>(args)...);
}
// log functions with no format string, just string
inline void trace(string_view_t msg, source_loc loc = source_loc::current())
{
log(loc, level::trace, msg);
log(loc, log_level::trace, msg);
}
inline void debug(string_view_t msg, source_loc loc = source_loc::current())
{
log(loc, level::debug, msg);
log(loc, log_level::debug, msg);
}
inline void info(string_view_t msg, source_loc loc = source_loc::current())
{
log(loc, level::info, msg);
log(loc, log_level::info, msg);
}
inline void warn(string_view_t msg, source_loc loc = source_loc::current())
{
log(loc, level::warn, msg);
log(loc, spdlog::log_level::warn, msg);
}
inline void error(string_view_t msg, source_loc loc = source_loc::current())
{
log(loc, level::err, msg);
log(loc, log_level::err, msg);
}
inline void critical(string_view_t msg, source_loc loc = source_loc::current())
{
log(loc, level::critical, msg);
log(loc, log_level::critical, msg);
}
#else
template<typename... Args>
inline void trace(format_string_t<Args...> fmt, Args &&...args)
{
log(level::trace, fmt, std::forward<Args>(args)...);
log(log_level::trace, fmt, std::forward<Args>(args)...);
}
template<typename... Args>
inline void debug(format_string_t<Args...> fmt, Args &&...args)
{
log(level::debug, fmt, std::forward<Args>(args)...);
log(log_level::debug, fmt, std::forward<Args>(args)...);
}
template<typename... Args>
inline void info(format_string_t<Args...> fmt, Args &&...args)
{
log(level::info, fmt, std::forward<Args>(args)...);
log(log_level::info, fmt, std::forward<Args>(args)...);
}
template<typename... Args>
inline void warn(format_string_t<Args...> fmt, Args &&...args)
{
log(level::warn, fmt, std::forward<Args>(args)...);
log(log_level::warn, fmt, std::forward<Args>(args)...);
}
template<typename... Args>
inline void error(format_string_t<Args...> fmt, Args &&...args)
{
log(level::err, fmt, std::forward<Args>(args)...);
log(log_level::err, fmt, std::forward<Args>(args)...);
}
template<typename... Args>
inline void critical(format_string_t<Args...> fmt, Args &&...args)
{
log(level::critical, fmt, std::forward<Args>(args)...);
log(log_level::critical, fmt, std::forward<Args>(args)...);
}
// log functions with no format string, just string
inline void trace(string_view_t msg)
{
log(level::trace, msg);
log(log_level::trace, msg);
}
inline void debug(string_view_t msg)
{
log(level::debug, msg);
log(log_level::debug, msg);
}
inline void info(string_view_t msg)
{
log(level::info, msg);
log(log_level::info, msg);
}
inline void warn(string_view_t msg)
{
log(level::warn, msg);
log(log_level::warn, msg);
}
inline void error(string_view_t msg)
{
log(level::err, msg);
log(log_level::err, msg);
}
inline void critical(string_view_t msg)
{
log(level::critical, msg);
log(log_level::critical, msg);
}
#endif
@@ -314,7 +314,7 @@ inline void critical(string_view_t msg)
#endif
#if SPDLOG_ACTIVE_LEVEL <= SPDLOG_LEVEL_TRACE
# define SPDLOG_LOGGER_TRACE(logger, ...) SPDLOG_LOGGER_CALL(logger, spdlog::level::trace, __VA_ARGS__)
# define SPDLOG_LOGGER_TRACE(logger, ...) SPDLOG_LOGGER_CALL(logger, spdlog::log_level::trace, __VA_ARGS__)
# define SPDLOG_TRACE(...) SPDLOG_LOGGER_TRACE(spdlog::default_logger_raw(), __VA_ARGS__)
#else
# define SPDLOG_LOGGER_TRACE(logger, ...) (void)0
@@ -322,7 +322,7 @@ inline void critical(string_view_t msg)
#endif
#if SPDLOG_ACTIVE_LEVEL <= SPDLOG_LEVEL_DEBUG
# define SPDLOG_LOGGER_DEBUG(logger, ...) SPDLOG_LOGGER_CALL(logger, spdlog::level::debug, __VA_ARGS__)
# define SPDLOG_LOGGER_DEBUG(logger, ...) SPDLOG_LOGGER_CALL(logger, spdlog::log_level::debug, __VA_ARGS__)
# define SPDLOG_DEBUG(...) SPDLOG_LOGGER_DEBUG(spdlog::default_logger_raw(), __VA_ARGS__)
#else
# define SPDLOG_LOGGER_DEBUG(logger, ...) (void)0
@@ -330,7 +330,7 @@ inline void critical(string_view_t msg)
#endif
#if SPDLOG_ACTIVE_LEVEL <= SPDLOG_LEVEL_INFO
# define SPDLOG_LOGGER_INFO(logger, ...) SPDLOG_LOGGER_CALL(logger, spdlog::level::info, __VA_ARGS__)
# define SPDLOG_LOGGER_INFO(logger, ...) SPDLOG_LOGGER_CALL(logger, spdlog::log_level::info, __VA_ARGS__)
# define SPDLOG_INFO(...) SPDLOG_LOGGER_INFO(spdlog::default_logger_raw(), __VA_ARGS__)
#else
# define SPDLOG_LOGGER_INFO(logger, ...) (void)0
@@ -338,7 +338,7 @@ inline void critical(string_view_t msg)
#endif
#if SPDLOG_ACTIVE_LEVEL <= SPDLOG_LEVEL_WARN
# define SPDLOG_LOGGER_WARN(logger, ...) SPDLOG_LOGGER_CALL(logger, spdlog::level::warn, __VA_ARGS__)
# define SPDLOG_LOGGER_WARN(logger, ...) SPDLOG_LOGGER_CALL(logger, spdlog::log_level::warn, __VA_ARGS__)
# define SPDLOG_WARN(...) SPDLOG_LOGGER_WARN(spdlog::default_logger_raw(), __VA_ARGS__)
#else
# define SPDLOG_LOGGER_WARN(logger, ...) (void)0
@@ -346,7 +346,7 @@ inline void critical(string_view_t msg)
#endif
#if SPDLOG_ACTIVE_LEVEL <= SPDLOG_LEVEL_ERROR
# define SPDLOG_LOGGER_ERROR(logger, ...) SPDLOG_LOGGER_CALL(logger, spdlog::level::err, __VA_ARGS__)
# define SPDLOG_LOGGER_ERROR(logger, ...) SPDLOG_LOGGER_CALL(logger, spdlog::log_level::err, __VA_ARGS__)
# define SPDLOG_ERROR(...) SPDLOG_LOGGER_ERROR(spdlog::default_logger_raw(), __VA_ARGS__)
#else
# define SPDLOG_LOGGER_ERROR(logger, ...) (void)0
@@ -354,7 +354,7 @@ inline void critical(string_view_t msg)
#endif
#if SPDLOG_ACTIVE_LEVEL <= SPDLOG_LEVEL_CRITICAL
# define SPDLOG_LOGGER_CRITICAL(logger, ...) SPDLOG_LOGGER_CALL(logger, spdlog::level::critical, __VA_ARGS__)
# define SPDLOG_LOGGER_CRITICAL(logger, ...) SPDLOG_LOGGER_CALL(logger, spdlog::log_level::critical, __VA_ARGS__)
# define SPDLOG_CRITICAL(...) SPDLOG_LOGGER_CRITICAL(spdlog::default_logger_raw(), __VA_ARGS__)
#else
# define SPDLOG_LOGGER_CRITICAL(logger, ...) (void)0