13 #include <initializer_list> 18 #include <type_traits> 19 #include <unordered_map> 21 #if defined(SPDLOG_WCHAR_FILENAMES) || defined(SPDLOG_WCHAR_TO_UTF8_SUPPORT) 31 #if defined(_MSC_VER) && (_MSC_VER < 1900) 32 #define SPDLOG_NOEXCEPT throw() 33 #define SPDLOG_CONSTEXPR 35 #define SPDLOG_NOEXCEPT noexcept 36 #define SPDLOG_CONSTEXPR constexpr 39 #if defined(__GNUC__) || defined(__clang__) 40 #define SPDLOG_DEPRECATED __attribute__((deprecated)) 41 #elif defined(_MSC_VER) 42 #define SPDLOG_DEPRECATED __declspec(deprecated) 44 #define SPDLOG_DEPRECATED 49 #if (defined(_MSC_VER) && (_MSC_VER < 1900)) || defined(__cplusplus_winrt) 50 #define SPDLOG_NO_TLS 1 55 #if FMT_HAS_FEATURE(__builtin_strrchr) 56 #define SPDLOG_STRRCHR(str, sep) __builtin_strrchr(str, sep) 58 #define SPDLOG_STRRCHR(str, sep) strrchr(str, sep) 59 #endif //__builtin_strrchr not defined 62 #define SPDLOG_FILE_BASENAME(file) SPDLOG_STRRCHR("\\" file, '\\') + 1 64 #define SPDLOG_FILE_BASENAME(file) SPDLOG_STRRCHR("/" file, '/') + 1 67 #ifndef SPDLOG_FUNCTION 68 #define SPDLOG_FUNCTION __FUNCTION__ 85 #if defined(FMT_USE_STD_STRING_VIEW) 91 #if defined(SPDLOG_NO_ATOMIC_LEVELS) 97 #define SPDLOG_LEVEL_TRACE 0 98 #define SPDLOG_LEVEL_DEBUG 1 99 #define SPDLOG_LEVEL_INFO 2 100 #define SPDLOG_LEVEL_WARN 3 101 #define SPDLOG_LEVEL_ERROR 4 102 #define SPDLOG_LEVEL_CRITICAL 5 103 #define SPDLOG_LEVEL_OFF 6 105 #if !defined(SPDLOG_ACTIVE_LEVEL) 106 #define SPDLOG_ACTIVE_LEVEL SPDLOG_LEVEL_INFO 122 #if !defined(SPDLOG_LEVEL_NAMES) 123 #define SPDLOG_LEVEL_NAMES \ 125 "trace", "debug", "info", "warning", "error", "critical", "off" \ 130 static const char *short_level_names[]{
"T",
"D",
"I",
"W",
"E",
"C",
"O"};
134 return level_string_views[l];
139 return short_level_names[l];
145 for (
const auto &level_str : level_string_views)
147 if (level_str == name)
176 : msg_(
std::move(msg))
199 #if defined(_WIN32) && defined(SPDLOG_WCHAR_FILENAMES) 215 , line{
static_cast<uint32_t
>(line)}
232 #if __cplusplus >= 201402L // C++14 and beyond 235 template<
typename T,
typename... Args>
238 static_assert(!std::is_array<T>::value,
"arrays not supported");
239 return std::unique_ptr<T>(
new T(std::forward<Args>(
args)...));
void warn(const char *fmt, const Args &... args)
spdlog::level::level_enum from_str(const std::string &name) SPDLOG_NOEXCEPT
std::initializer_list< sink_ptr > sinks_init_list
#define SPDLOG_LEVEL_WARN
SPDLOG_CONSTEXPR source_loc()
const char * what() const SPDLOG_NOEXCEPT override
If we are still before C++14, supply the fodder for doing the "indices trick".
#define SPDLOG_LEVEL_INFO
#define SPDLOG_LEVEL_NAMES
#define SPDLOG_LEVEL_TRACE
#define SPDLOG_LEVEL_DEBUG
std::shared_ptr< sinks::sink > sink_ptr
spdlog_ex(const std::string &msg, int last_errno)
std::hash< int > level_hasher
void info(const char *fmt, const Args &... args)
basic_string_view< char > string_view
#define SPDLOG_LEVEL_ERROR
void trace(const char *fmt, const Args &... args)
spdlog_ex(std::string msg)
void debug(const char *fmt, const Args &... args)
std::chrono::system_clock log_clock
void critical(const char *fmt, const Args &... args)
string_view_t & to_string_view(spdlog::level::level_enum l) SPDLOG_NOEXCEPT
fmt::string_view string_view_t
std::unique_ptr< T > make_unique(Args &&... args)
const char * to_short_c_str(spdlog::level::level_enum l) SPDLOG_NOEXCEPT
std::atomic< int > level_t
SPDLOG_CONSTEXPR bool empty() const SPDLOG_NOEXCEPT
#define SPDLOG_LEVEL_CRITICAL
std::function< void(const std::string &err_msg)> log_err_handler
SPDLOG_CONSTEXPR source_loc(const char *filename, int line, const char *funcname)