Agora
1.2.0
Agora project
|
Go to the documentation of this file.
11 #include <initializer_list>
15 #include <type_traits>
19 #ifdef SPDLOG_USE_STD_FORMAT
20 # include <string_view>
23 #ifdef SPDLOG_COMPILED_LIB
24 # undef SPDLOG_HEADER_ONLY
25 # if defined(SPDLOG_SHARED_LIB)
27 # ifdef spdlog_EXPORTS
28 # define SPDLOG_API __declspec(dllexport)
29 # else // !spdlog_EXPORTS
30 # define SPDLOG_API __declspec(dllimport)
32 # else // !defined(_WIN32)
33 # define SPDLOG_API __attribute__((visibility("default")))
35 # else // !defined(SPDLOG_SHARED_LIB)
38 # define SPDLOG_INLINE
39 #else // !defined(SPDLOG_COMPILED_LIB)
41 # define SPDLOG_HEADER_ONLY
42 # define SPDLOG_INLINE inline
43 #endif // #ifdef SPDLOG_COMPILED_LIB
47 #ifndef SPDLOG_USE_STD_FORMAT
48 # if FMT_VERSION >= 80000 // backward compatibility with fmt versions older than 8
49 # define SPDLOG_FMT_RUNTIME(format_string) fmt::runtime(format_string)
50 # if defined(SPDLOG_WCHAR_FILENAMES) || defined(SPDLOG_WCHAR_TO_UTF8_SUPPORT)
54 # define SPDLOG_FMT_RUNTIME(format_string) format_string
59 #if defined(_MSC_VER) && (_MSC_VER < 1900)
60 # define SPDLOG_NOEXCEPT _NOEXCEPT
61 # define SPDLOG_CONSTEXPR
62 # define SPDLOG_CONSTEXPR_FUNC
64 # define SPDLOG_NOEXCEPT noexcept
65 # define SPDLOG_CONSTEXPR constexpr
66 # if __cplusplus >= 201402L
67 # define SPDLOG_CONSTEXPR_FUNC constexpr
69 # define SPDLOG_CONSTEXPR_FUNC
73 #if defined(__GNUC__) || defined(__clang__)
74 # define SPDLOG_DEPRECATED __attribute__((deprecated))
75 #elif defined(_MSC_VER)
76 # define SPDLOG_DEPRECATED __declspec(deprecated)
78 # define SPDLOG_DEPRECATED
83 # if (defined(_MSC_VER) && (_MSC_VER < 1900)) || defined(__cplusplus_winrt)
84 # define SPDLOG_NO_TLS 1
88 #ifndef SPDLOG_FUNCTION
89 # define SPDLOG_FUNCTION static_cast<const char *>(__FUNCTION__)
92 #ifdef SPDLOG_NO_EXCEPTIONS
94 # define SPDLOG_THROW(ex) \
97 printf("spdlog fatal error: %s\n", ex.what()); \
100 # define SPDLOG_CATCH_STD
102 # define SPDLOG_TRY try
103 # define SPDLOG_THROW(ex) throw(ex)
104 # define SPDLOG_CATCH_STD \
105 catch (const std::exception &) {}
116 #if defined(_WIN32) && defined(SPDLOG_WCHAR_FILENAMES)
119 # define SPDLOG_FILENAME_T_INNER(s) L##s
120 # define SPDLOG_FILENAME_T(s) SPDLOG_FILENAME_T_INNER(s)
123 # define SPDLOG_FILENAME_T(s) s
130 #ifdef SPDLOG_USE_STD_FORMAT
136 template<
typename... Args>
139 template<
class T,
class Char =
char>
143 # if defined(SPDLOG_WCHAR_FILENAMES) || defined(SPDLOG_WCHAR_TO_UTF8_SUPPORT)
145 using wmemory_buf_t = std::wstring;
147 template<
typename... Args>
151 #else // use fmt lib instead of std::format
157 template<
typename... Args>
165 template<
class T,
class Char =
char>
167 : std::integral_constant<bool,
168 std::is_convertible<T, fmt::basic_string_view<Char>>::value || std::is_same<remove_cvref_t<T>, fmt::basic_runtime<Char>>::value>
171 # if defined(SPDLOG_WCHAR_FILENAMES) || defined(SPDLOG_WCHAR_TO_UTF8_SUPPORT)
175 template<
typename... Args>
180 #ifdef SPDLOG_WCHAR_TO_UTF8_SUPPORT
182 # error SPDLOG_WCHAR_TO_UTF8_SUPPORT only supported on windows
184 #endif // SPDLOG_WCHAR_TO_UTF8_SUPPORT
188 is_convertible_to_basic_format_string<T, wchar_t>::value>
191 #if defined(SPDLOG_NO_ATOMIC_LEVELS)
197 #define SPDLOG_LEVEL_TRACE 0
198 #define SPDLOG_LEVEL_DEBUG 1
199 #define SPDLOG_LEVEL_INFO 2
200 #define SPDLOG_LEVEL_WARN 3
201 #define SPDLOG_LEVEL_ERROR 4
202 #define SPDLOG_LEVEL_CRITICAL 5
203 #define SPDLOG_LEVEL_OFF 6
205 #if !defined(SPDLOG_ACTIVE_LEVEL)
206 # define SPDLOG_ACTIVE_LEVEL SPDLOG_LEVEL_INFO
223 #define SPDLOG_LEVEL_NAME_TRACE spdlog::string_view_t("trace", 5)
224 #define SPDLOG_LEVEL_NAME_DEBUG spdlog::string_view_t("debug", 5)
225 #define SPDLOG_LEVEL_NAME_INFO spdlog::string_view_t("info", 4)
226 #define SPDLOG_LEVEL_NAME_WARNING spdlog::string_view_t("warning", 7)
227 #define SPDLOG_LEVEL_NAME_ERROR spdlog::string_view_t("error", 5)
228 #define SPDLOG_LEVEL_NAME_CRITICAL spdlog::string_view_t("critical", 8)
229 #define SPDLOG_LEVEL_NAME_OFF spdlog::string_view_t("off", 3)
231 #if !defined(SPDLOG_LEVEL_NAMES)
232 # define SPDLOG_LEVEL_NAMES \
234 SPDLOG_LEVEL_NAME_TRACE, SPDLOG_LEVEL_NAME_DEBUG, SPDLOG_LEVEL_NAME_INFO, SPDLOG_LEVEL_NAME_WARNING, SPDLOG_LEVEL_NAME_ERROR, \
235 SPDLOG_LEVEL_NAME_CRITICAL, SPDLOG_LEVEL_NAME_OFF \
239 #if !defined(SPDLOG_SHORT_LEVEL_NAMES)
241 # define SPDLOG_SHORT_LEVEL_NAMES \
243 "T", "D", "I", "W", "E", "C", "O" \
280 spdlog_ex(
const std::string &msg,
int last_errno);
326 #if __cplusplus >= 201402L // C++14 and beyond
330 template<
bool B,
class T =
void>
333 template<
typename T,
typename... Args>
337 return std::unique_ptr<T>(
new T(std::forward<Args>(args)...));
345 return static_cast<T>(value);
357 #ifdef SPDLOG_HEADER_ONLY
const SPDLOG_INLINE string_view_t & to_string_view(spdlog::level::level_enum l) SPDLOG_NOEXCEPT
Definition: common-inl.h:23
basic_string_view< char > string_view
Definition: core.h:540
const char * funcname
Definition: common.h:305
#define SPDLOG_LEVEL_DEBUG
Definition: common.h:198
#define SPDLOG_NOEXCEPT
Definition: common.h:64
@ trace
Definition: common.h:213
const char * filename
Definition: common.h:303
#define SPDLOG_LEVEL_INFO
Definition: common.h:199
file_event_handlers()
Definition: common.h:314
@ off
Definition: common.h:219
GeneratorWrapper< T > value(T &&value)
Definition: catch.hpp:3999
fmt::basic_string_view< char > string_view_t
Definition: common.h:154
std::shared_ptr< sinks::sink > sink_ptr
Definition: common.h:127
@ warn
Definition: common.h:216
constexpr T conditional_static_cast(U value)
Definition: common.h:343
std::atomic< int > level_t
Definition: common.h:194
basic_string_view< wchar_t > wstring_view
Definition: xchar.h:24
std::function< void(const filename_t &filename, std::FILE *file_stream)> before_close
Definition: common.h:312
std::initializer_list< sink_ptr > sinks_init_list
Definition: common.h:128
#define SPDLOG_LEVEL_TRACE
Definition: common.h:197
@ info
Definition: common.h:215
level_enum
Definition: common.h:211
@ debug
Definition: common.h:214
constexpr source_loc()=default
@ err
Definition: common.h:217
std::chrono::system_clock log_clock
Definition: common.h:126
#define SPDLOG_LEVEL_WARN
Definition: common.h:200
SPDLOG_INLINE spdlog::level::level_enum from_str(const std::string &name) SPDLOG_NOEXCEPT
Definition: common-inl.h:33
filename
Definition: parse_all_dl.m:14
typename std::enable_if< B, T >::type enable_if_t
Definition: common.h:331
SPDLOG_INLINE void throw_spdlog_ex(const std::string &msg, int last_errno)
Definition: common-inl.h:72
const SPDLOG_INLINE char * to_short_c_str(spdlog::level::level_enum l) SPDLOG_NOEXCEPT
Definition: common-inl.h:28
typename std::remove_cv< typename std::remove_reference< T >::type >::type remove_cvref_t
Definition: common.h:161
j template void())
Definition: json.hpp:4744
std::string msg_
Definition: common.h:284
#define SPDLOG_LEVEL_CRITICAL
Definition: common.h:202
Definition: null_mutex.h:22
std::unique_ptr< T > make_unique(Args &&... args)
Definition: common.h:334
int line
Definition: common.h:304
std::function< void(const std::string &err_msg)> err_handler
Definition: common.h:129
function[avg_proc_duration, std_proc_duration]
Definition: parse_dl_file.m:1
std::function< void(const filename_t &filename, std::FILE *file_stream)> after_open
Definition: common.h:311
std::function< void(const filename_t &filename)> after_close
Definition: common.h:313
pattern_time_type
Definition: common.h:267
Definition: json.hpp:5213
Definition: bin_to_hex.h:102
#define SPDLOG_LEVEL_ERROR
Definition: common.h:201
std::function< void(const filename_t &filename)> before_open
Definition: common.h:310
#define SPDLOG_LEVEL_OFF
Definition: common.h:203
l
Definition: parse_all_dl.m:71
std::string filename_t
Definition: common.h:122
@ critical
Definition: common.h:218
#define SPDLOG_API
Definition: common.h:40
constexpr source_loc(const char *filename_in, int line_in, const char *funcname_in)
Definition: common.h:293
@ n_levels
Definition: common.h:220
color_mode
Definition: common.h:256
constexpr bool empty() const noexcept
Definition: common.h:299
#define SPDLOG_CONSTEXPR
Definition: common.h:65
type
Definition: core.h:1131