diff --git a/include/spdlog/details/fmt_helper.h b/include/spdlog/details/fmt_helper.h index 5052cc22..ddfea6c5 100644 --- a/include/spdlog/details/fmt_helper.h +++ b/include/spdlog/details/fmt_helper.h @@ -16,8 +16,12 @@ inline void append_str(const std::string &str, fmt::memory_buffer &dest) inline void append_c_str(const char *c_str, fmt::memory_buffer &dest) { - auto str_size = strlen(c_str); - dest.append(c_str, c_str + str_size); + char ch; + while ((ch = *c_str) != '\0') + { + dest.push_back(ch); + ++c_str; + } } inline void append_buf(const fmt::memory_buffer &buf, fmt::memory_buffer &dest) diff --git a/include/spdlog/details/pattern_formatter_impl.h b/include/spdlog/details/pattern_formatter_impl.h index 278593b1..541ca944 100644 --- a/include/spdlog/details/pattern_formatter_impl.h +++ b/include/spdlog/details/pattern_formatter_impl.h @@ -506,7 +506,6 @@ class full_formatter SPDLOG_FINAL : public flag_formatter #endif dest.push_back('['); - // wrap the level name with color msg.color_range_start = dest.size(); fmt_helper::append_c_str(level::to_str(msg.level), dest);