From: Florian Forster Date: Sat, 25 Feb 2012 16:33:05 +0000 (+0100) Subject: syslog plugin: Log "OKAY" notifications with severity "NOTICE". X-Git-Tag: collectd-5.1.0~19 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=02af2c25b7bff96610cd5c10af928a040f3c15f3;p=collectd.git syslog plugin: Log "OKAY" notifications with severity "NOTICE". It's a noteworthy event that implies normal operation, i.e. NOTICE. Also renamed "severity" to "log_severity" to emphasize its use. Change-Id: I7f3e4b12dabeb0caa9c9c8c86924bf77b2627ba1 --- diff --git a/src/syslog.c b/src/syslog.c index fd313dd7..a3153517 100644 --- a/src/syslog.c +++ b/src/syslog.c @@ -83,7 +83,7 @@ static int sl_notification (const notification_t *n, char *buf_ptr = buf; int buf_len = sizeof (buf); int status; - int severity; + int log_severity; if (n->severity > notif_severity) return (0); @@ -113,22 +113,25 @@ static int sl_notification (const notification_t *n, APPEND (buf_ptr, buf_len, "type_instance", n->type_instance); APPEND (buf_ptr, buf_len, "message", n->message); +#undef APPEND + buf[sizeof (buf) - 1] = '\0'; switch (n->severity) { case NOTIF_FAILURE: - severity = LOG_ERR; + log_severity = LOG_ERR; break; case NOTIF_WARNING: - severity = LOG_WARNING; + log_severity = LOG_WARNING; break; case NOTIF_OKAY: - severity = LOG_WARNING; + log_severity = LOG_NOTICE; break; - default: severity = LOG_INFO; + default: + log_severity = LOG_ERR; } - sl_log (severity, buf, NULL); + sl_log (log_severity, buf, NULL); return (0); } /* int sl_notification */