syslog plugin: Log "OKAY" notifications with severity "NOTICE".
authorFlorian Forster <octo@collectd.org>
Sat, 25 Feb 2012 16:33:05 +0000 (17:33 +0100)
committerFlorian Forster <octo@collectd.org>
Sat, 25 Feb 2012 16:33:05 +0000 (17:33 +0100)
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

index fd313dd..a315351 100644 (file)
@@ -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 */