-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
How can I get this output format? #2424
Comments
Per-log-level formatting is not supported. However, you can create your own custom sink and format it specifically for each log level. Use the format flags |
If you don't like the awkwardness of typing the ALL CAPS macro (I don't), you can write your own macro, like so: #define debug(...) log(spdlog::source_loc{FILE, LINE, static_cast<const char *>(FUNCTION)}, spdlog::level::debug, VA_ARGS) This will work with or even Getting my logger So I end up with a very log4j like syntax that gives line numbers, file, method. See also related open issue #1823. Output with file:linenumber is extremely useful in an IDE in order for the log output to link to the source. Wouldn't take a big effort to make something like the above configurable in spdlog if they thought it was important, one would think. Meaning just to make the file and line number accessible with less awkward macro identifier. |
@thank you so much @oct15demo ! Great! |
Hi,
I would like to know how can I set different formats for each spdlog level.
By default, I got this output format:
What I would like
info
warning
error
,critical
anddebug
Second question
Is there a way to add the function name (PRETTY_FUNCTION) in the log?
Like:
Could you help me?
Thank you,
The text was updated successfully, but these errors were encountered: