diff --git a/include/spdlog/common.h b/include/spdlog/common.h index 20dfdb06e..13981eaaf 100644 --- a/include/spdlog/common.h +++ b/include/spdlog/common.h @@ -202,29 +202,8 @@ class SPDLOG_API spdlog_ex : public std::exception { }; [[noreturn]] SPDLOG_API void throw_spdlog_ex(const std::string &msg, int last_errno); - [[noreturn]] SPDLOG_API void throw_spdlog_ex(std::string msg); -// trick to capture format string and caller's source location with variadic template. -// see logger::info() etc. to understand how it's used. -struct loc_with_fmt { - source_loc loc; - string_view_t fmt_string; - - template > - constexpr loc_with_fmt(S fmt_str, source_loc loc = source_loc::current()) noexcept - : loc(loc), - fmt_string(fmt_str) {} - -#ifndef SPDLOG_USE_STD_FORMAT - - constexpr loc_with_fmt(fmt::runtime_format_string fmt_str, source_loc loc = source_loc::current()) noexcept - : loc(loc), - fmt_string(fmt_str.str) {} - -#endif -}; - struct file_event_handlers { file_event_handlers() : before_open(nullptr), diff --git a/include/spdlog/source_loc.h b/include/spdlog/source_loc.h index db0e99283..f58217b98 100644 --- a/include/spdlog/source_loc.h +++ b/include/spdlog/source_loc.h @@ -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 \ No newline at end of file +} // namespace spdlog diff --git a/tests/test_source_location.cpp b/tests/test_source_location.cpp index 4c161c9aa..c48200166 100644 --- a/tests/test_source_location.cpp +++ b/tests/test_source_location.cpp @@ -19,6 +19,3 @@ TEST_CASE("test_source_location", "[source_location]") { REQUIRE(test_sink->lines().size() == 2); REQUIRE(test_sink->lines()[1] == "test_source_location.cpp:18 Hello"); } - - -//REQUIRE(oss.str() == std::string("test_source_location.cpp:20 Hello source location") + default_eol);