projects
/
collectd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
ChangeLog: Add the pinba plugin.
[collectd.git]
/
src
/
syslog.c
diff --git
a/src/syslog.c
b/src/syslog.c
index
bcf873e
..
ace9dc6
100644
(file)
--- a/
src/syslog.c
+++ b/
src/syslog.c
@@
-28,7
+28,11
@@
# include <syslog.h>
#endif
# include <syslog.h>
#endif
+#if COLLECT_DEBUG
static int log_level = LOG_DEBUG;
static int log_level = LOG_DEBUG;
+#else
+static int log_level = LOG_INFO;
+#endif /* COLLECT_DEBUG */
static const char *config_keys[] =
{
static const char *config_keys[] =
{
@@
-51,7
+55,7
@@
static int sl_config (const char *key, const char *value)
log_level = LOG_NOTICE;
else if (strcasecmp (value, "info") == 0)
log_level = LOG_INFO;
log_level = LOG_NOTICE;
else if (strcasecmp (value, "info") == 0)
log_level = LOG_INFO;
-#if COLLECT
D
_DEBUG
+#if COLLECT_DEBUG
else if (strcasecmp (value, "debug") == 0)
log_level = LOG_DEBUG;
#endif
else if (strcasecmp (value, "debug") == 0)
log_level = LOG_DEBUG;
#endif
@@
-64,19
+68,13
@@
static int sl_config (const char *key, const char *value)
return (0);
} /* int sl_config */
return (0);
} /* int sl_config */
-static int sl_init (void)
+static void sl_log (int severity, const char *msg,
+ user_data_t __attribute__((unused)) *user_data)
{
{
- openlog ("collectd", LOG_CONS | LOG_PID, LOG_DAEMON);
-
- return (0);
-}
-
-static void sl_log (int sevetiry, const char *msg)
-{
- if (sevetiry > log_level)
+ if (severity > log_level)
return;
return;
- syslog (seve
tir
y, "%s", msg);
+ syslog (seve
rit
y, "%s", msg);
} /* void sl_log */
static int sl_shutdown (void)
} /* void sl_log */
static int sl_shutdown (void)
@@
-88,10
+86,9
@@
static int sl_shutdown (void)
void module_register (void)
{
void module_register (void)
{
+ openlog ("collectd", LOG_CONS | LOG_PID, LOG_DAEMON);
+
plugin_register_config ("syslog", sl_config, config_keys, config_keys_num);
plugin_register_config ("syslog", sl_config, config_keys, config_keys_num);
- plugin_register_init ("syslog", sl_init);
- plugin_register_log ("syslog", sl_log);
+ plugin_register_log ("syslog", sl_log, /* user_data = */ NULL);
plugin_register_shutdown ("syslog", sl_shutdown);
plugin_register_shutdown ("syslog", sl_shutdown);
-
- return;
} /* void module_register(void) */
} /* void module_register(void) */