From 08f41d4f65be9567e3a381428afc476339043655 Mon Sep 17 00:00:00 2001 From: Chris Hiszpanski Date: Wed, 21 Oct 2015 11:49:35 -0700 Subject: [PATCH] Update syslog_sink.h Syslog already adds formatting, such as the identifier set with `openlog` in the constructor, the priority, and timestamp -- using the formatted message duplicates this information in the log message. This especially causes problems when the syslog is forwarded to aggregators such as Loggly, Logstash, etc. which can parse log messages which are JSON. However, the duplicated fields which spdlog prepends interfere with this -- better to use `raw` in the syslog case I think, or perhaps add an ability to use custom formatters on individual sinks. --- include/spdlog/sinks/syslog_sink.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/spdlog/sinks/syslog_sink.h b/include/spdlog/sinks/syslog_sink.h index 37b65136..97e7aee3 100644 --- a/include/spdlog/sinks/syslog_sink.h +++ b/include/spdlog/sinks/syslog_sink.h @@ -75,7 +75,7 @@ public: void log(const details::log_msg &msg) override { - ::syslog(syslog_prio_from_level(msg), "%s", msg.formatted.str().c_str()); + ::syslog(syslog_prio_from_level(msg), "%s", msg.raw.str().c_str()); } void flush() override