Idea/feature-request: Line-brek/new-line decorators? #3655
Lord-Kamina
started this conversation in
Ideas
Replies: 1 comment
|
I think this could be achieved by parsing the log messages using a custom flag formatter. |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
I've recently found myself adding new-line decorators to make formatting of multi-line debug messages easier on the eyes.
I'm using the following pattern:
In this case the number of spaces is arbitrary and accounts for the formatting I'm using for the timestamp.
So then, for a large message I'll do something like the following:
std::string logmsg{fmt::format( "Found system paths:\n" "{8}base: {0}\n" "{8}share: {1}\n" "{8}locale: {2}\n" "{8}sysConf: {3}\n" "{8}home {4}\n" "{8}config: {5}\n" "{8}data: {6}\n" "{8}cache: {7}", base, share, locale, sysConf, home, conf, data, cache, SpdLogger::newLineDec )};And it looks pretty nice, like so:
Would it be feasible to have such a thing as a built-in option in spdlog, such that it (optionally) detects line-breaks automatically and appends a configurable string such as what I'm using?
All reactions