|
|
|
@ -26,20 +26,6 @@ struct source_loc {
|
|
|
|
|
short_filename{basename(filename_in)},
|
|
|
|
|
line{line_in},
|
|
|
|
|
funcname{funcname_in} {}
|
|
|
|
|
|
|
|
|
|
#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_HAVE_EXPERIMENTAL_SOURCE_LOCATION)
|
|
|
|
|
static constexpr source_loc current(
|
|
|
|
|
const std::experimental::source_location source_location = std::experimental::source_location::current()) {
|
|
|
|
|
return source_loc{source_location.file_name(), source_location.line(), source_location.function_name()};
|
|
|
|
|
}
|
|
|
|
|
#else // no source location support
|
|
|
|
|
static constexpr source_loc current() { return source_loc{}; }
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
[[nodiscard]] constexpr bool empty() const noexcept { return line == 0 || filename == nullptr || short_filename == nullptr; }
|
|
|
|
|
|
|
|
|
|
const char *filename{nullptr};
|
|
|
|
@ -64,4 +50,4 @@ struct source_loc {
|
|
|
|
|
return file;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
} // namespace spdlog
|
|
|
|
|
} // namespace spdlog
|
|
|
|
|