From 94c2810b0a358f9bf52d2995b239b576ee6731ce Mon Sep 17 00:00:00 2001 From: gabime Date: Fri, 28 Jun 2019 01:41:11 +0300 Subject: [PATCH] Reduced max padding 128=>64 --- include/spdlog/details/pattern_formatter-inl.h | 6 ++---- tests/test_pattern_formatter.cpp | 8 +++----- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/include/spdlog/details/pattern_formatter-inl.h b/include/spdlog/details/pattern_formatter-inl.h index fe92e7b9..14d93f08 100644 --- a/include/spdlog/details/pattern_formatter-inl.h +++ b/include/spdlog/details/pattern_formatter-inl.h @@ -84,9 +84,7 @@ private: const padding_info &padinfo_; fmt::memory_buffer &dest_; size_t total_pad_; - string_view_t spaces_{" " - " ", - 128}; + string_view_t spaces_{" ", 64}; }; class name_formatter : public flag_formatter @@ -1217,7 +1215,7 @@ SPDLOG_INLINE details::padding_info pattern_formatter::handle_padspec_(std::stri { using details::padding_info; using details::scoped_pad; - const size_t max_width = 128; + const size_t max_width = 64; if (it == end) { return padding_info{}; diff --git a/tests/test_pattern_formatter.cpp b/tests/test_pattern_formatter.cpp index f9d23d2a..094554e7 100644 --- a/tests/test_pattern_formatter.cpp +++ b/tests/test_pattern_formatter.cpp @@ -183,16 +183,14 @@ TEST_CASE("left_padded_huge", "[pattern_formatter]") { REQUIRE( log_to_str("Some message", "[%-300n] %v", spdlog::pattern_time_type::local, "\n") == - "[pattern_tester ]" - " Some message\n"); + "[pattern_tester ] Some message\n"); } TEST_CASE("left_padded_max", "[pattern_formatter]") { REQUIRE( - log_to_str("Some message", "[%-128n] %v", spdlog::pattern_time_type::local, "\n") == - "[pattern_tester ]" - " Some message\n"); + log_to_str("Some message", "[%-64n] %v", spdlog::pattern_time_type::local, "\n") == + "[pattern_tester ] Some message\n"); } TEST_CASE("clone-default-formatter", "[pattern_formatter]")