diff --git a/include/spdlog/details/file_helper.h b/include/spdlog/details/file_helper.h index f72820004d4483219c4ee3f3d63244a55ad74e53..8c1132d9c5e9ff02fa27b43ceeb2cc9a887f4141 100644 --- a/include/spdlog/details/file_helper.h +++ b/include/spdlog/details/file_helper.h @@ -122,7 +122,7 @@ public: // ".mylog" => (".mylog". "") // "my_folder/.mylog" => ("my_folder/.mylog", "") // "my_folder/.mylog.txt" => ("my_folder/.mylog", ".txt") - static std::tuple<filename_t, filename_t> split_by_extenstion(const spdlog::filename_t &fname) + static std::tuple<filename_t, filename_t> split_by_extension(const spdlog::filename_t &fname) { auto ext_index = fname.rfind('.'); diff --git a/include/spdlog/sinks/daily_file_sink.h b/include/spdlog/sinks/daily_file_sink.h index 376a1ab03a5773b67741c2aeb96cdaafbefa90ee..d20de4421eabe2800fc60006e4bfca998286150c 100644 --- a/include/spdlog/sinks/daily_file_sink.h +++ b/include/spdlog/sinks/daily_file_sink.h @@ -32,7 +32,7 @@ struct daily_filename_calculator static filename_t calc_filename(const filename_t &filename, const tm &now_tm) { filename_t basename, ext; - std::tie(basename, ext) = details::file_helper::split_by_extenstion(filename); + std::tie(basename, ext) = details::file_helper::split_by_extension(filename); std::conditional<std::is_same<filename_t::value_type, char>::value, fmt::memory_buffer, fmt::wmemory_buffer>::type w; fmt::format_to( w, SPDLOG_FILENAME_T("{}_{:04d}-{:02d}-{:02d}{}"), basename, now_tm.tm_year + 1900, now_tm.tm_mon + 1, now_tm.tm_mday, ext); diff --git a/include/spdlog/sinks/rotating_file_sink.h b/include/spdlog/sinks/rotating_file_sink.h index ef210d839a44aff6fc0a7aef9cc8cecf2275217c..73c377d4fbe7e3c83eb11c7f6e05cf3fcaac5ec5 100644 --- a/include/spdlog/sinks/rotating_file_sink.h +++ b/include/spdlog/sinks/rotating_file_sink.h @@ -48,7 +48,7 @@ public: if (index != 0u) { filename_t basename, ext; - std::tie(basename, ext) = details::file_helper::split_by_extenstion(filename); + std::tie(basename, ext) = details::file_helper::split_by_extension(filename); fmt::format_to(w, SPDLOG_FILENAME_T("{}.{}{}"), basename, index, ext); } else diff --git a/tests/test_file_helper.cpp b/tests/test_file_helper.cpp index ecdc5afeac7cb3c409a1b52e121e37e0be52bb67..073ef93a9b2a50d20760aa5a8efe4717b6c9b357 100644 --- a/tests/test_file_helper.cpp +++ b/tests/test_file_helper.cpp @@ -81,12 +81,12 @@ static void test_split_ext(const char *fname, const char *expect_base, const cha std::replace(expected_base.begin(), expected_base.end(), '/', '\\'); #endif spdlog::filename_t basename, ext; - std::tie(basename, ext) = file_helper::split_by_extenstion(filename); + std::tie(basename, ext) = file_helper::split_by_extension(filename); REQUIRE(basename == expected_base); REQUIRE(ext == expected_ext); } -TEST_CASE("file_helper_split_by_extenstion", "[file_helper::split_by_extenstion()]]") +TEST_CASE("file_helper_split_by_extension", "[file_helper::split_by_extension()]]") { test_split_ext("mylog.txt", "mylog", ".txt"); test_split_ext(".mylog.txt", ".mylog", ".txt");