Upgraded spdlog to v1.11.0

This commit is contained in:
Bartek Kryza
2023-06-03 18:00:54 +02:00
parent a78839eecf
commit 12f129a6fe
72 changed files with 6797 additions and 4117 deletions

View File

@@ -31,7 +31,7 @@ using default_factory = synchronous_factory;
// Example:
// spdlog::create<daily_file_sink_st>("logger_name", "dailylog_filename", 11, 59);
template<typename Sink, typename... SinkArgs>
inline std::shared_ptr<spdlog::logger> create(std::string logger_name, SinkArgs &&...sink_args)
inline std::shared_ptr<spdlog::logger> create(std::string logger_name, SinkArgs &&... sink_args)
{
return default_factory::create<Sink>(std::move(logger_name), std::forward<SinkArgs>(sink_args)...);
}
@@ -81,7 +81,11 @@ SPDLOG_API void flush_on(level::level_enum log_level);
// Start/Restart a periodic flusher thread
// Warning: Use only if all your loggers are thread safe!
SPDLOG_API void flush_every(std::chrono::seconds interval);
template<typename Rep, typename Period>
inline void flush_every(std::chrono::duration<Rep, Period> interval)
{
details::registry::instance().flush_every(interval);
}
// Set global error handler
SPDLOG_API void set_error_handler(void (*handler)(const std::string &msg));
@@ -128,49 +132,49 @@ SPDLOG_API spdlog::logger *default_logger_raw();
SPDLOG_API void set_default_logger(std::shared_ptr<spdlog::logger> default_logger);
template<typename... Args>
inline void log(source_loc source, level::level_enum lvl, fmt::format_string<Args...> fmt, Args &&...args)
inline void log(source_loc source, level::level_enum 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, fmt::format_string<Args...> fmt, Args &&...args)
inline void log(level::level_enum lvl, format_string_t<Args...> fmt, Args &&... args)
{
default_logger_raw()->log(source_loc{}, lvl, fmt, std::forward<Args>(args)...);
}
template<typename... Args>
inline void trace(fmt::format_string<Args...> fmt, Args &&...args)
inline void trace(format_string_t<Args...> fmt, Args &&... args)
{
default_logger_raw()->trace(fmt, std::forward<Args>(args)...);
}
template<typename... Args>
inline void debug(fmt::format_string<Args...> fmt, Args &&...args)
inline void debug(format_string_t<Args...> fmt, Args &&... args)
{
default_logger_raw()->debug(fmt, std::forward<Args>(args)...);
}
template<typename... Args>
inline void info(fmt::format_string<Args...> fmt, Args &&...args)
inline void info(format_string_t<Args...> fmt, Args &&... args)
{
default_logger_raw()->info(fmt, std::forward<Args>(args)...);
}
template<typename... Args>
inline void warn(fmt::format_string<Args...> fmt, Args &&...args)
inline void warn(format_string_t<Args...> fmt, Args &&... args)
{
default_logger_raw()->warn(fmt, std::forward<Args>(args)...);
}
template<typename... Args>
inline void error(fmt::format_string<Args...> fmt, Args &&...args)
inline void error(format_string_t<Args...> fmt, Args &&... args)
{
default_logger_raw()->error(fmt, std::forward<Args>(args)...);
}
template<typename... Args>
inline void critical(fmt::format_string<Args...> fmt, Args &&...args)
inline void critical(format_string_t<Args...> fmt, Args &&... args)
{
default_logger_raw()->critical(fmt, std::forward<Args>(args)...);
}
@@ -189,49 +193,49 @@ inline void log(level::level_enum lvl, const T &msg)
#ifdef SPDLOG_WCHAR_TO_UTF8_SUPPORT
template<typename... Args>
inline void log(source_loc source, level::level_enum lvl, fmt::wformat_string<Args...> fmt, Args &&...args)
inline void log(source_loc source, level::level_enum lvl, wformat_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, fmt::wformat_string<Args...> fmt, Args &&...args)
inline void log(level::level_enum lvl, wformat_string_t<Args...> fmt, Args &&... args)
{
default_logger_raw()->log(source_loc{}, lvl, fmt, std::forward<Args>(args)...);
}
template<typename... Args>
inline void trace(fmt::wformat_string<Args...> fmt, Args &&...args)
inline void trace(wformat_string_t<Args...> fmt, Args &&... args)
{
default_logger_raw()->trace(fmt, std::forward<Args>(args)...);
}
template<typename... Args>
inline void debug(fmt::wformat_string<Args...> fmt, Args &&...args)
inline void debug(wformat_string_t<Args...> fmt, Args &&... args)
{
default_logger_raw()->debug(fmt, std::forward<Args>(args)...);
}
template<typename... Args>
inline void info(fmt::wformat_string<Args...> fmt, Args &&...args)
inline void info(wformat_string_t<Args...> fmt, Args &&... args)
{
default_logger_raw()->info(fmt, std::forward<Args>(args)...);
}
template<typename... Args>
inline void warn(fmt::wformat_string<Args...> fmt, Args &&...args)
inline void warn(wformat_string_t<Args...> fmt, Args &&... args)
{
default_logger_raw()->warn(fmt, std::forward<Args>(args)...);
}
template<typename... Args>
inline void error(fmt::wformat_string<Args...> fmt, Args &&...args)
inline void error(wformat_string_t<Args...> fmt, Args &&... args)
{
default_logger_raw()->error(fmt, std::forward<Args>(args)...);
}
template<typename... Args>
inline void critical(fmt::wformat_string<Args...> fmt, Args &&...args)
inline void critical(wformat_string_t<Args...> fmt, Args &&... args)
{
default_logger_raw()->critical(fmt, std::forward<Args>(args)...);
}
@@ -288,7 +292,12 @@ inline void critical(const T &msg)
// SPDLOG_LEVEL_OFF
//
#define SPDLOG_LOGGER_CALL(logger, level, ...) (logger)->log(spdlog::source_loc{__FILE__, __LINE__, SPDLOG_FUNCTION}, level, __VA_ARGS__)
#ifndef SPDLOG_NO_SOURCE_LOC
# define SPDLOG_LOGGER_CALL(logger, level, ...) \
(logger)->log(spdlog::source_loc{__FILE__, __LINE__, SPDLOG_FUNCTION}, level, __VA_ARGS__)
#else
# define SPDLOG_LOGGER_CALL(logger, level, ...) (logger)->log(spdlog::source_loc{}, level, __VA_ARGS__)
#endif
#if SPDLOG_ACTIVE_LEVEL <= SPDLOG_LEVEL_TRACE
# define SPDLOG_LOGGER_TRACE(logger, ...) SPDLOG_LOGGER_CALL(logger, spdlog::level::trace, __VA_ARGS__)