|
|
|
@ -5,6 +5,7 @@
|
|
|
|
|
|
|
|
|
|
#include <spdlog/tweakme.h>
|
|
|
|
|
#include <spdlog/details/null_mutex.h>
|
|
|
|
|
#include <spdlog/details/source_location.h>
|
|
|
|
|
|
|
|
|
|
#include <atomic>
|
|
|
|
|
#include <chrono>
|
|
|
|
@ -16,6 +17,8 @@
|
|
|
|
|
#include <functional>
|
|
|
|
|
#include <cstdio>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef SPDLOG_USE_STD_FORMAT
|
|
|
|
|
# include <version>
|
|
|
|
|
# if __cpp_lib_format >= 202207L
|
|
|
|
@ -114,6 +117,45 @@ namespace spdlog {
|
|
|
|
|
|
|
|
|
|
class formatter;
|
|
|
|
|
|
|
|
|
|
struct source_loc
|
|
|
|
|
{
|
|
|
|
|
SPDLOG_CONSTEXPR source_loc() = default;
|
|
|
|
|
SPDLOG_CONSTEXPR source_loc(const char *filename_in, int line_in, const char *funcname_in)
|
|
|
|
|
: filename{filename_in}
|
|
|
|
|
, line{line_in}
|
|
|
|
|
, funcname{funcname_in}
|
|
|
|
|
{}
|
|
|
|
|
|
|
|
|
|
SPDLOG_CONSTEXPR bool empty() const SPDLOG_NOEXCEPT
|
|
|
|
|
{
|
|
|
|
|
return line == 0;
|
|
|
|
|
}
|
|
|
|
|
const char *filename{nullptr};
|
|
|
|
|
int line{0};
|
|
|
|
|
const char *funcname{nullptr};
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
template<typename T>
|
|
|
|
|
struct format_string_wrapper
|
|
|
|
|
{
|
|
|
|
|
format_string_wrapper(const char *fmt, details::source_location loc = details::source_location::current())
|
|
|
|
|
: fmt_{fmt}
|
|
|
|
|
, loc_{loc}
|
|
|
|
|
{}
|
|
|
|
|
T fmt()
|
|
|
|
|
{
|
|
|
|
|
return fmt_;
|
|
|
|
|
}
|
|
|
|
|
source_loc loc()
|
|
|
|
|
{
|
|
|
|
|
return source_loc{loc_.file_name(), loc_.line(), loc_.function_name()};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
T fmt_;
|
|
|
|
|
spdlog::details::source_location loc_;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
namespace sinks {
|
|
|
|
|
class sink;
|
|
|
|
|
}
|
|
|
|
@ -138,13 +180,15 @@ namespace fmt_lib = std;
|
|
|
|
|
using string_view_t = std::string_view;
|
|
|
|
|
using memory_buf_t = std::string;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
template<typename... Args>
|
|
|
|
|
# if __cpp_lib_format >= 202207L
|
|
|
|
|
using format_string_t = std::format_string<Args...>;
|
|
|
|
|
using format_string_t = format_string_wrapper<std::format_string<Args...>>;
|
|
|
|
|
# else
|
|
|
|
|
using format_string_t = std::string_view;
|
|
|
|
|
using format_string_t = format_string_wrapper<std::string_view>;
|
|
|
|
|
# endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
template<class T, class Char = char>
|
|
|
|
|
struct is_convertible_to_basic_format_string : std::integral_constant<bool, std::is_convertible<T, std::basic_string_view<Char>>::value>
|
|
|
|
|
{};
|
|
|
|
@ -155,9 +199,9 @@ using wmemory_buf_t = std::wstring;
|
|
|
|
|
|
|
|
|
|
template<typename... Args>
|
|
|
|
|
# if __cpp_lib_format >= 202207L
|
|
|
|
|
using wformat_string_t = std::wformat_string<Args...>;
|
|
|
|
|
using wformat_string_t = format_string_wrapper<std::wformat_string<Args...>>;
|
|
|
|
|
# else
|
|
|
|
|
using wformat_string_t = std::wstring_view;
|
|
|
|
|
using wformat_string_t = format_string_wrapper<std::wstring_view>;
|
|
|
|
|
# endif
|
|
|
|
|
# endif
|
|
|
|
|
# define SPDLOG_BUF_TO_STRING(x) x
|
|
|
|
@ -168,7 +212,7 @@ using string_view_t = fmt::basic_string_view<char>;
|
|
|
|
|
using memory_buf_t = fmt::basic_memory_buffer<char, 250>;
|
|
|
|
|
|
|
|
|
|
template<typename... Args>
|
|
|
|
|
using format_string_t = fmt::format_string<Args...>;
|
|
|
|
|
using format_string_t = format_string_wrapper<fmt::format_string<Args...>>;
|
|
|
|
|
|
|
|
|
|
template<class T>
|
|
|
|
|
using remove_cvref_t = typename std::remove_cv<typename std::remove_reference<T>::type>::type;
|
|
|
|
@ -301,24 +345,6 @@ private:
|
|
|
|
|
[[noreturn]] SPDLOG_API void throw_spdlog_ex(const std::string &msg, int last_errno);
|
|
|
|
|
[[noreturn]] SPDLOG_API void throw_spdlog_ex(std::string msg);
|
|
|
|
|
|
|
|
|
|
struct source_loc
|
|
|
|
|
{
|
|
|
|
|
SPDLOG_CONSTEXPR source_loc() = default;
|
|
|
|
|
SPDLOG_CONSTEXPR source_loc(const char *filename_in, int line_in, const char *funcname_in)
|
|
|
|
|
: filename{filename_in}
|
|
|
|
|
, line{line_in}
|
|
|
|
|
, funcname{funcname_in}
|
|
|
|
|
{}
|
|
|
|
|
|
|
|
|
|
SPDLOG_CONSTEXPR bool empty() const SPDLOG_NOEXCEPT
|
|
|
|
|
{
|
|
|
|
|
return line == 0;
|
|
|
|
|
}
|
|
|
|
|
const char *filename{nullptr};
|
|
|
|
|
int line{0};
|
|
|
|
|
const char *funcname{nullptr};
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct file_event_handlers
|
|
|
|
|
{
|
|
|
|
|
file_event_handlers()
|
|
|
|
|