X-Git-Url: https://git.octo.it/?p=collectd.git;a=blobdiff_plain;f=src%2Fsyslog.c;h=ee3d9f934681cea63700adf2bdf7a5f2c17feaa8;hp=55de164bc42a7e9d890d12cedb09c2da92477c17;hb=54619dc85fd308b21ed09a0271e5c7383c7921b9;hpb=be126043c2be20399d7670fe194645292018bde0 diff --git a/src/syslog.c b/src/syslog.c index 55de164b..ee3d9f93 100644 --- a/src/syslog.c +++ b/src/syslog.c @@ -26,8 +26,8 @@ #include "collectd.h" -#include "common.h" #include "plugin.h" +#include "utils/common/common.h" #if HAVE_SYSLOG_H #include @@ -38,10 +38,11 @@ static int log_level = LOG_DEBUG; #else static int log_level = LOG_INFO; #endif /* COLLECT_DEBUG */ -static int notif_severity = 0; +static int notif_severity; static const char *config_keys[] = { - "LogLevel", "NotifyLevel", + "LogLevel", + "NotifyLevel", }; static int config_keys_num = STATIC_ARRAY_SIZE(config_keys); @@ -50,13 +51,14 @@ static int sl_config(const char *key, const char *value) { log_level = parse_log_severity(value); if (log_level < 0) { log_level = LOG_INFO; - ERROR("syslog: invalid loglevel [%s] defaulting to 'info'", value); - return 1; + WARNING("syslog: invalid loglevel [%s] defaulting to 'info'", value); } } else if (strcasecmp(key, "NotifyLevel") == 0) { notif_severity = parse_notif_severity(value); - if (notif_severity < 0) + if (notif_severity < 0) { + ERROR("syslog: invalid notification severity [%s]", value); return 1; + } } return 0; @@ -107,7 +109,7 @@ static int sl_notification(const notification_t *n, #define BUFFER_ADD(...) \ do { \ - status = snprintf(&buf[offset], sizeof(buf) - offset, __VA_ARGS__); \ + status = snprintf(&buf[offset], sizeof(buf) - offset, __VA_ARGS__); \ if (status < 1) \ return -1; \ else if (((size_t)status) >= (sizeof(buf) - offset)) \