@ -17,8 +17,13 @@
# include <cstdio>
# include <cstdio>
# ifdef SPDLOG_USE_STD_FORMAT
# ifdef SPDLOG_USE_STD_FORMAT
# include <version>
# if __cpp_lib_format >= 202207L
# include <format>
# else
# include <string_view>
# include <string_view>
# endif
# endif
# endif
# ifdef SPDLOG_COMPILED_LIB
# ifdef SPDLOG_COMPILED_LIB
# undef SPDLOG_HEADER_ONLY
# undef SPDLOG_HEADER_ONLY
@ -59,14 +64,14 @@
# if defined(_MSC_VER) && (_MSC_VER < 1900)
# if defined(_MSC_VER) && (_MSC_VER < 1900)
# define SPDLOG_NOEXCEPT _NOEXCEPT
# define SPDLOG_NOEXCEPT _NOEXCEPT
# define SPDLOG_CONSTEXPR
# define SPDLOG_CONSTEXPR
# define SPDLOG_CONSTEXPR_FUNC
# define SPDLOG_CONSTEXPR_FUNC inline
# else
# else
# define SPDLOG_NOEXCEPT noexcept
# define SPDLOG_NOEXCEPT noexcept
# define SPDLOG_CONSTEXPR constexpr
# define SPDLOG_CONSTEXPR constexpr
# if __cplusplus >= 201402L
# if __cplusplus >= 201402L
# define SPDLOG_CONSTEXPR_FUNC constexpr
# define SPDLOG_CONSTEXPR_FUNC constexpr
# else
# else
# define SPDLOG_CONSTEXPR_FUNC
# define SPDLOG_CONSTEXPR_FUNC inline
# endif
# endif
# endif
# endif
@ -134,7 +139,11 @@ using string_view_t = std::string_view;
using memory_buf_t = std : : string ;
using memory_buf_t = std : : string ;
template < typename . . . Args >
template < typename . . . Args >
# if __cpp_lib_format >= 202207L
using format_string_t = std : : format_string < Args . . . > ;
# else
using format_string_t = std : : string_view ;
using format_string_t = std : : string_view ;
# endif
template < class T , class Char = char >
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 >
struct is_convertible_to_basic_format_string : std : : integral_constant < bool , std : : is_convertible < T , std : : basic_string_view < Char > > : : value >
@ -145,8 +154,12 @@ using wstring_view_t = std::wstring_view;
using wmemory_buf_t = std : : wstring ;
using wmemory_buf_t = std : : wstring ;
template < typename . . . Args >
template < typename . . . Args >
# if __cpp_lib_format >= 202207L
using wformat_string_t = std : : wformat_string < Args . . . > ;
# else
using wformat_string_t = std : : wstring_view ;
using wformat_string_t = std : : wstring_view ;
# endif
# endif
# endif
# define SPDLOG_BUF_TO_STRING(x) x
# define SPDLOG_BUF_TO_STRING(x) x
# else // use fmt lib instead of std::format
# else // use fmt lib instead of std::format
namespace fmt_lib = fmt ;
namespace fmt_lib = fmt ;
@ -323,6 +336,44 @@ struct file_event_handlers
namespace details {
namespace details {
// to_string_view
SPDLOG_CONSTEXPR_FUNC spdlog : : string_view_t to_string_view ( const memory_buf_t & buf ) SPDLOG_NOEXCEPT
{
return spdlog : : string_view_t { buf . data ( ) , buf . size ( ) } ;
}
SPDLOG_CONSTEXPR_FUNC spdlog : : string_view_t to_string_view ( spdlog : : string_view_t str ) SPDLOG_NOEXCEPT
{
return str ;
}
# if defined(SPDLOG_WCHAR_FILENAMES) || defined(SPDLOG_WCHAR_TO_UTF8_SUPPORT)
SPDLOG_CONSTEXPR_FUNC spdlog : : wstring_view_t to_string_view ( const wmemory_buf_t & buf ) SPDLOG_NOEXCEPT
{
return spdlog : : wstring_view_t { buf . data ( ) , buf . size ( ) } ;
}
SPDLOG_CONSTEXPR_FUNC spdlog : : wstring_view_t to_string_view ( spdlog : : wstring_view_t str ) SPDLOG_NOEXCEPT
{
return str ;
}
# endif
# ifndef SPDLOG_USE_STD_FORMAT
template < typename T , typename . . . Args >
inline fmt : : basic_string_view < T > to_string_view ( fmt : : basic_format_string < T , Args . . . > fmt )
{
return fmt ;
}
# elif __cpp_lib_format >= 202207L
template < typename T , typename . . . Args >
SPDLOG_CONSTEXPR_FUNC std : : basic_string_view < T > to_string_view ( std : : basic_format_string < T , Args . . . > fmt ) SPDLOG_NOEXCEPT
{
return fmt . get ( ) ;
}
# endif
// make_unique support for pre c++14
// make_unique support for pre c++14
# if __cplusplus >= 201402L // C++14 and beyond
# if __cplusplus >= 201402L // C++14 and beyond