summaryrefslogtreecommitdiff
path: root/src/mongo/logger/syslog_appender.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/logger/syslog_appender.h')
-rw-r--r--src/mongo/logger/syslog_appender.h64
1 files changed, 32 insertions, 32 deletions
diff --git a/src/mongo/logger/syslog_appender.h b/src/mongo/logger/syslog_appender.h
index df0ba489fdf..ebdba636f5f 100644
--- a/src/mongo/logger/syslog_appender.h
+++ b/src/mongo/logger/syslog_appender.h
@@ -40,41 +40,41 @@
namespace mongo {
namespace logger {
- /**
- * Appender for writing to syslog. Users must have separately called openlog().
- */
- template <typename Event>
- class SyslogAppender : public Appender<Event> {
- MONGO_DISALLOW_COPYING(SyslogAppender);
+/**
+ * Appender for writing to syslog. Users must have separately called openlog().
+ */
+template <typename Event>
+class SyslogAppender : public Appender<Event> {
+ MONGO_DISALLOW_COPYING(SyslogAppender);
- public:
- typedef Encoder<Event> EventEncoder;
+public:
+ typedef Encoder<Event> EventEncoder;
- explicit SyslogAppender(EventEncoder* encoder) : _encoder(encoder) {}
- virtual Status append(const Event& event) {
- std::ostringstream os;
- _encoder->encode(event, os);
- if (!os)
- return Status(ErrorCodes::LogWriteFailed, "Error writing log message to syslog.");
- syslog(getSyslogPriority(event.getSeverity()), "%s", os.str().c_str());
- return Status::OK();
- }
+ explicit SyslogAppender(EventEncoder* encoder) : _encoder(encoder) {}
+ virtual Status append(const Event& event) {
+ std::ostringstream os;
+ _encoder->encode(event, os);
+ if (!os)
+ return Status(ErrorCodes::LogWriteFailed, "Error writing log message to syslog.");
+ syslog(getSyslogPriority(event.getSeverity()), "%s", os.str().c_str());
+ return Status::OK();
+ }
- private:
- int getSyslogPriority(LogSeverity severity) {
- if (severity <= LogSeverity::Debug(1))
- return LOG_DEBUG;
- if (severity == LogSeverity::Warning())
- return LOG_WARNING;
- if (severity == LogSeverity::Error())
- return LOG_ERR;
- if (severity >= LogSeverity::Severe())
- return LOG_CRIT;
- // Info() and Log().
- return LOG_INFO;
- }
- std::unique_ptr<EventEncoder> _encoder;
- };
+private:
+ int getSyslogPriority(LogSeverity severity) {
+ if (severity <= LogSeverity::Debug(1))
+ return LOG_DEBUG;
+ if (severity == LogSeverity::Warning())
+ return LOG_WARNING;
+ if (severity == LogSeverity::Error())
+ return LOG_ERR;
+ if (severity >= LogSeverity::Severe())
+ return LOG_CRIT;
+ // Info() and Log().
+ return LOG_INFO;
+ }
+ std::unique_ptr<EventEncoder> _encoder;
+};
} // namespace logger
} // namespace mongo