summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 2cbd373)
raw | patch | inline | side by side (parent: 2cbd373)
author | Wilfried Goesgens <dothebart@citadel.org> | |
Sat, 23 May 2015 13:44:24 +0000 (15:44 +0200) | ||
committer | Marc Fournier <marc.fournier@camptocamp.com> | |
Tue, 26 May 2015 12:12:09 +0000 (14:12 +0200) |
src/daemon/filter_chain.c | patch | blob | history | |
src/daemon/plugin.c | patch | blob | history | |
src/daemon/plugin.h | patch | blob | history |
index b93435fd0afc8bcd1caa8b8d60497aede96b6496..32ce7367c8a3a11ac1647d04815c024b30fecc87 100644 (file)
"all write plugins failed with status %i (ENOENT). "
"Most likely this means you didn't load any write plugins.",
status);
+
+ plugin_log_available_writers ();
}
else if (status != 0)
{
"Filter subsystem: Built-in target `write': Dispatching value to "
"the `%s' plugin failed with status %i.",
plugin_list[i].plugin, status);
+
+ plugin_log_available_writers ();
}
else
{
diff --git a/src/daemon/plugin.c b/src/daemon/plugin.c
index 25bd37b8983aa40d0fa366914c7572f11c1598e6..b69e65b6a75b2413b6f777694fd9f73fb92ace12 100644 (file)
--- a/src/daemon/plugin.c
+++ b/src/daemon/plugin.c
return (0);
} /* }}} int register_callback */
+static void log_list_callbacks (llist_t **list, /* {{{ */
+ const char *comment)
+{
+ char *str;
+ int len;
+ llentry_t *le;
+ int i;
+ int n;
+ char **keys;
+
+ n = llist_size(*list);
+ if (n == 0)
+ {
+ INFO("%s [none]", comment);
+ return;
+ }
+
+ keys = calloc(n, sizeof(char*));
+
+ if (keys == NULL)
+ {
+ ERROR("%s: failed to allocate memory for list of callbacks",
+ comment);
+
+ return;
+ }
+
+ for (le = llist_head (*list), i = 0, len = 0;
+ le != NULL;
+ le = le->next, i++)
+ {
+ keys[i] = le->key;
+ len += strlen(le->key) + 6;
+ }
+ str = malloc(len + 10);
+ if (str == NULL)
+ {
+ ERROR("%s: failed to allocate memory for list of callbacks",
+ comment);
+ }
+ else
+ {
+ *str = '\0';
+ strjoin(str, len, keys, n, "', '");
+ INFO("%s ['%s']", comment, str);
+ free(str);
+ }
+ free(keys);
+} /* }}} void log_list_callbacks */
+
static int create_register_callback (llist_t **list, /* {{{ */
const char *name, void *callback, user_data_t *ud)
{
return (0);
} /* }}} int plugin_unregister_read */
+void plugin_log_available_writers ()
+{
+ log_list_callbacks (&list_write, "Available writers:");
+}
+
static int compare_read_func_group (llentry_t *e, void *ud) /* {{{ */
{
read_func_t *rf = e->value;
diff --git a/src/daemon/plugin.h b/src/daemon/plugin.h
index 86a2d6625acaa7937fd44f7eb3f453bcfc2f9df8..beeb576159fd9f3ce4647aeeabc7bf58ca0fae9d 100644 (file)
--- a/src/daemon/plugin.h
+++ b/src/daemon/plugin.h
int plugin_unregister_log (const char *name);
int plugin_unregister_notification (const char *name);
+/*
+ * NAME
+ * plugin_log_available_writers
+ *
+ * DESCRIPTION
+ * This function can be called to output a list of _all_ registered
+ * writers to the logfacility.
+ * Since some writers dynamically build their name it can be hard for
+ * the configuring person to know it. This function will fill this gap.
+ */
+void plugin_log_available_writers ();
/*
* NAME