-
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
syslog formatting (request) #729
Comments
Yes, it is by design, since syslog already formats the messages. |
@gabime , I understand why you design like this, but will you consider providing the option to format syslog as well? |
A possible approach would be to inherit syslog sink (override the sink_it_ method) to do what you need (for this the private section of the syslog sink should be comverted to protected though). |
Thanks for advice. Indeed that is the approach I had chosen. But to be honest, unless a user only uses a single syslog sink, he may face the awkward situation about replicating the formatting for syslog. |
That happens anyway in spdlog. Each sink has it's own private formatter copy, and use it to format the message, so that's fine. Most of the time the formatting is so fast that this it doens't matter. |
Implemented with additional boolean to ctor (true to format). |
spdlog does not write formatted messages to syslog. In syslog_sink.h:
::syslog(syslog_prio_from_level(msg), "%s", msg.raw.str().c_str());
Is this behavior by design?
I would prefer to get a formatted message also for syslog:
::syslog(syslog_prio_from_level(msg), "%s", msg.formatted.str().c_str());
The text was updated successfully, but these errors were encountered: