From 03c025a97f0307db57b1eb949e70273fca7bac7a Mon Sep 17 00:00:00 2001 From: OEOTYAN Date: Fri, 8 Nov 2024 18:56:45 +0800 Subject: [PATCH] refactor: remove useless base --- src/ll/api/command/Overload.h | 2 +- src/ll/api/io/PatternFormatter.cpp | 17 +++++++++-------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/ll/api/command/Overload.h b/src/ll/api/command/Overload.h index 3f4724a21a..9a136d3223 100644 --- a/src/ll/api/command/Overload.h +++ b/src/ll/api/command/Overload.h @@ -48,7 +48,7 @@ class Overload : private OverloadData { } explicit Overload(CommandHandle& handle, std::weak_ptr mod) : OverloadData(handle, std::move(mod)) {} - class ParamName : public std::string_view { + class ParamName { std::string_view str; int idx; diff --git a/src/ll/api/io/PatternFormatter.cpp b/src/ll/api/io/PatternFormatter.cpp index 02d5f282ee..4c801df664 100644 --- a/src/ll/api/io/PatternFormatter.cpp +++ b/src/ll/api/io/PatternFormatter.cpp @@ -35,23 +35,24 @@ static constexpr auto makeBracketed(T const& value, bool bracketed) -> Bracketed void PatternFormatter::format(LogMessageView const& view, std::string& buffer) const noexcept try { auto lvlIdx = std::to_underlying(view.lvl); + using namespace fmt::literals; if (colored) { fmt::format_to( std::back_inserter(buffer), fmt::runtime(pattern), - fmt::arg("msg", fmt::styled(makeBracketed(view.msg, bracketed[0]), styles[lvlIdx][0])), - fmt::arg("tit", fmt::styled(makeBracketed(view.tit, bracketed[1]), styles[lvlIdx][1])), - fmt::arg("lvl", fmt::styled(makeBracketed(levelNames[lvlIdx], bracketed[2]), styles[lvlIdx][2])), - fmt::arg("tm", fmt::styled(makeBracketed(view.tm, bracketed[3]), styles[lvlIdx][3])) + "msg"_a = fmt::styled(makeBracketed(view.msg, bracketed[0]), styles[lvlIdx][0]), + "tit"_a = fmt::styled(makeBracketed(view.tit, bracketed[1]), styles[lvlIdx][1]), + "lvl"_a = fmt::styled(makeBracketed(levelNames[lvlIdx], bracketed[2]), styles[lvlIdx][2]), + "tm"_a = fmt::styled(makeBracketed(view.tm, bracketed[3]), styles[lvlIdx][3]) ); } else { fmt::format_to( std::back_inserter(buffer), fmt::runtime(pattern), - fmt::arg("msg", makeBracketed(string_utils::removeEscapeCode(view.msg), bracketed[0])), - fmt::arg("tit", makeBracketed(view.tit, bracketed[1])), - fmt::arg("lvl", makeBracketed(levelNames[lvlIdx], bracketed[2])), - fmt::arg("tm", makeBracketed(view.tm, bracketed[3])) + "msg"_a = makeBracketed(string_utils::removeEscapeCode(view.msg), bracketed[0]), + "tit"_a = makeBracketed(view.tit, bracketed[1]), + "lvl"_a = makeBracketed(levelNames[lvlIdx], bracketed[2]), + "tm"_a = makeBracketed(view.tm, bracketed[3]) ); } buffer.push_back('\n');