mirror of
https://github.com/gabime/spdlog.git
synced 2025-09-30 10:29:02 +08:00
check SPDLOG_SOURCE_LOCATION in macros and in runtime
This commit is contained in:
@@ -24,10 +24,10 @@
|
||||
|
||||
#if __cpp_lib_source_location >= 201907
|
||||
# include <source_location>
|
||||
# define SPDLOG_STD_SOURCE_LOCATION
|
||||
# define SPDLOG_HAVE_STD_SOURCE_LOCATION
|
||||
#elif __has_include(<experimental/source_location>)
|
||||
# include <experimental/source_location>
|
||||
# define SPDLOG_EXPERIMENTAL_SOURCE_LOCATION
|
||||
# define SPDLOG_HAVE_EXPERIMENTAL_SOURCE_LOCATION
|
||||
#endif
|
||||
|
||||
#ifdef SPDLOG_USE_STD_FORMAT
|
||||
@@ -254,12 +254,12 @@ struct source_loc
|
||||
, funcname{funcname_in}
|
||||
{}
|
||||
|
||||
#ifdef SPDLOG_STD_SOURCE_LOCATION
|
||||
#ifdef SPDLOG_HAVE_STD_SOURCE_LOCATION
|
||||
static constexpr source_loc current(const std::source_location source_location = std::source_location::current())
|
||||
{
|
||||
return source_loc{source_location.file_name(), source_location.line(), source_location.function_name()};
|
||||
}
|
||||
#elif defined(SPDLOG_EXPERIMENTAL_SOURCE_LOCATION)
|
||||
#elif defined(SPDLOG_HAVE_EXPERIMENTAL_SOURCE_LOCATION)
|
||||
static constexpr source_loc current(
|
||||
const std::experimental::source_location source_location = std::experimental::source_location::current())
|
||||
{
|
||||
|
Reference in New Issue
Block a user