Adding a "subsystem" to log messages? #3197
Unanswered
Lord-Kamina
asked this question in
Q&A
Replies: 1 comment 3 replies
-
Context (PR #2907) and custom formatter (https://github.com/gabime/spdlog/wiki/3.-Custom-formatting#extending-spdlog-with-your-own-flags) may be used. |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi. I'm currently looking into replacing a very clunky in-house logger with spdlog. In our current logger, we have "subsystems" (which are really just implemented as arbitrary strings) to mark what section of the app a message is coming from.
With our current format we might have messages reading like this:
I understand I could replicate such a thing by creating a different logger for each subsystem and using the logger's name, but we really have a lot of those and I think it would end up being a tremendous mess.
I was wondering if there's any way I can just pass the subsystem in as a parameter to each logger call, and have the default log format be something like:
[%Y-%m-%d @ %T] %^*SUBSYSTEM HERE*/%l%$ -- %v
Beta Was this translation helpful? Give feedback.
All reactions