Skip to content

spdlog level alignment question #3413

Closed Answered by tt4g
wanzzhehe asked this question in Q&A
Jun 6, 2025 · 2 comments · 2 replies
Discussion options

You must be logged in to vote

Yes, the Align flag only affects format patterns, so alignments are generated in square brackets that appear before or after the format pattern.
Please create a custom formatter with reference to level_formatter:

// log level appender
template <typename ScopedPadder>
class level_formatter final : public flag_formatter {
public:
explicit level_formatter(padding_info padinfo)
: flag_formatter(padinfo) {}
void format(const details::log_msg &msg, const std::tm &, memory_buf_t &dest) override {
const string_view_t &level_name = level::to_string_view(msg.level);
Sco…

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
1 reply
@wanzzhehe
Comment options

Answer selected by wanzzhehe
Comment options

You must be logged in to vote
1 reply
@wanzzhehe
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants