From 02af2c25b7bff96610cd5c10af928a040f3c15f3 Mon Sep 17 00:00:00 2001 From: Florian Forster Date: Sat, 25 Feb 2012 17:33:05 +0100 Subject: [PATCH 1/1] 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 --- src/syslog.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) 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 */ -- 2.11.0