18#ifdef SPDLOG_COMPILED_LIB
19# undef SPDLOG_HEADER_ONLY
20# if defined(_WIN32) && defined(SPDLOG_SHARED_LIB)
22# define SPDLOG_API __declspec(dllexport)
24# define SPDLOG_API __declspec(dllimport)
32# define SPDLOG_HEADER_ONLY
33# define SPDLOG_INLINE inline
39#if FMT_VERSION >= 80000
40# define SPDLOG_FMT_RUNTIME(format_string) fmt::runtime(format_string)
41# if defined(SPDLOG_WCHAR_FILENAMES) || defined(SPDLOG_WCHAR_TO_UTF8_SUPPORT)
45# define SPDLOG_FMT_RUNTIME(format_string) format_string
49#if defined(_MSC_VER) && (_MSC_VER < 1900)
50# define SPDLOG_NOEXCEPT _NOEXCEPT
51# define SPDLOG_CONSTEXPR
53# define SPDLOG_NOEXCEPT noexcept
54# define SPDLOG_CONSTEXPR constexpr
57#if defined(__GNUC__) || defined(__clang__)
58# define SPDLOG_DEPRECATED __attribute__((deprecated))
59#elif defined(_MSC_VER)
60# define SPDLOG_DEPRECATED __declspec(deprecated)
62# define SPDLOG_DEPRECATED
67# if (defined(_MSC_VER) && (_MSC_VER < 1900)) || defined(__cplusplus_winrt)
68# define SPDLOG_NO_TLS 1
72#ifndef SPDLOG_FUNCTION
73# define SPDLOG_FUNCTION static_cast<const char *>(__FUNCTION__)
76#ifdef SPDLOG_NO_EXCEPTIONS
78# define SPDLOG_THROW(ex) \
81 printf("spdlog fatal error: %s\n", ex.what()); \
84# define SPDLOG_CATCH_STD
86# define SPDLOG_TRY try
87# define SPDLOG_THROW(ex) throw(ex)
88# define SPDLOG_CATCH_STD \
89 catch (const std::exception &) {}
100#if defined(_WIN32) && defined(SPDLOG_WCHAR_FILENAMES)
103# define SPDLOG_FILENAME_T_INNER(s) L##s
104# define SPDLOG_FILENAME_T(s) SPDLOG_FILENAME_T_INNER(s)
107# define SPDLOG_FILENAME_T(s) s
124template<
class T,
class Char =
char>
127 std::is_convertible<T, fmt::basic_string_view<Char>>::value || std::is_same<remove_cvref_t<T>, fmt::basic_runtime<Char>>::value>
130#ifdef SPDLOG_WCHAR_TO_UTF8_SUPPORT
132# error SPDLOG_WCHAR_TO_UTF8_SUPPORT only supported on windows
138 is_convertible_to_basic_format_string<T, wchar_t>::value>
141#if defined(SPDLOG_NO_ATOMIC_LEVELS)
147#define SPDLOG_LEVEL_TRACE 0
148#define SPDLOG_LEVEL_DEBUG 1
149#define SPDLOG_LEVEL_INFO 2
150#define SPDLOG_LEVEL_WARN 3
151#define SPDLOG_LEVEL_ERROR 4
152#define SPDLOG_LEVEL_CRITICAL 5
153#define SPDLOG_LEVEL_OFF 6
155#if !defined(SPDLOG_ACTIVE_LEVEL)
156# define SPDLOG_ACTIVE_LEVEL SPDLOG_LEVEL_INFO
173#define SPDLOG_LEVEL_NAME_TRACE spdlog::string_view_t("trace", 5)
174#define SPDLOG_LEVEL_NAME_DEBUG spdlog::string_view_t("debug", 5)
175#define SPDLOG_LEVEL_NAME_INFO spdlog::string_view_t("info", 4)
176#define SPDLOG_LEVEL_NAME_WARNING spdlog::string_view_t("warning", 7)
177#define SPDLOG_LEVEL_NAME_ERROR spdlog::string_view_t("error", 5)
178#define SPDLOG_LEVEL_NAME_CRITICAL spdlog::string_view_t("critical", 8)
179#define SPDLOG_LEVEL_NAME_OFF spdlog::string_view_t("off", 3)
181#if !defined(SPDLOG_LEVEL_NAMES)
182# define SPDLOG_LEVEL_NAMES \
184 SPDLOG_LEVEL_NAME_TRACE, SPDLOG_LEVEL_NAME_DEBUG, SPDLOG_LEVEL_NAME_INFO, SPDLOG_LEVEL_NAME_WARNING, SPDLOG_LEVEL_NAME_ERROR, \
185 SPDLOG_LEVEL_NAME_CRITICAL, SPDLOG_LEVEL_NAME_OFF \
189#if !defined(SPDLOG_SHORT_LEVEL_NAMES)
191# define SPDLOG_SHORT_LEVEL_NAMES \
193 "T", "D", "I", "W", "E", "C", "O" \
261#if __cplusplus >= 201402L
264template<
typename T,
typename... Args>
274#ifdef SPDLOG_HEADER_ONLY
#define SPDLOG_LEVEL_INFO
#define SPDLOG_LEVEL_DEBUG
#define SPDLOG_LEVEL_TRACE
#define SPDLOG_LEVEL_ERROR
#define SPDLOG_LEVEL_CRITICAL
#define SPDLOG_LEVEL_WARN
std::unique_ptr< T > make_unique(Args &&...args)
SPDLOG_INLINE spdlog::level::level_enum from_str(const std::string &name) SPDLOG_NOEXCEPT
SPDLOG_INLINE const char * to_short_c_str(spdlog::level::level_enum l) SPDLOG_NOEXCEPT
fmt::basic_memory_buffer< wchar_t, 250 > wmemory_buf_t
fmt::basic_string_view< wchar_t > wstring_view_t
typename std::remove_cv< typename std::remove_reference< T >::type >::type remove_cvref_t
fmt::basic_string_view< char > string_view_t
SPDLOG_INLINE void throw_spdlog_ex(const std::string &msg, int last_errno)
fmt::basic_memory_buffer< char, 250 > memory_buf_t
SPDLOG_CONSTEXPR bool empty() const SPDLOG_NOEXCEPT
SPDLOG_CONSTEXPR source_loc()=default
SPDLOG_CONSTEXPR source_loc(const char *filename_in, int line_in, const char *funcname_in)