Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pattern width is not applied for missing source information #2201

Closed
Nedra1998 opened this issue Dec 5, 2021 · 0 comments · Fixed by #2269
Closed

Pattern width is not applied for missing source information #2201

Nedra1998 opened this issue Dec 5, 2021 · 0 comments · Fixed by #2269
Labels

Comments

@Nedra1998
Copy link

If the width is set in the format pattern for one of the source information fields (for example %10s), this width is only applied for messages which contain the source information. For example, this code

#include <spdlog/spdlog.h>

int main(int argc, char *argv[]) {
  spdlog::set_pattern("(%10s:%10#:%10!) %v");

  spdlog::info("Hello World");
  SPDLOG_INFO("Hello World");
}

will produce the output

$ ./a.out
(::) Hello World
(  main.cpp:         7:      main) Hello World

while I would expect it to produce output similar to this, to respect the alignment specified, even if the fields are not available.

$ ./a.out
(          :          :          ) Hello World
(  main.cpp:         7:      main) Hello World
@gabime gabime added the bug label Dec 5, 2021
gabime added a commit that referenced this issue Feb 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants