summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 1bbb066)
raw | patch | inline | side by side (parent: 1bbb066)
author | Sebastian Harl <sh@tokkee.org> | |
Wed, 25 Jun 2014 21:12:44 +0000 (23:12 +0200) | ||
committer | Sebastian Harl <sh@tokkee.org> | |
Wed, 25 Jun 2014 21:12:44 +0000 (23:12 +0200) |
An internal logger may currently be registered by the frontend which uses it
to send log messages to a client. Usually, these internal loggers will not
actually log stuff. Thus, we'll have to ignore them when deciding about
fallbacks.
to send log messages to a client. Usually, these internal loggers will not
actually log stuff. Thus, we'll have to ignore them when deciding about
fallbacks.
src/core/plugin.c | patch | blob | history |
diff --git a/src/core/plugin.c b/src/core/plugin.c
index 8cd490a22a7da2f39e946f4d06be445fda1ebba7..b3d5973178dffed19411af5d5acea45a99b718e3 100644 (file)
--- a/src/core/plugin.c
+++ b/src/core/plugin.c
sdb_llist_iter_t *iter;
int ret = -1;
+ _Bool logged = 0;
+
if (! msg)
return 0;
- if (! sdb_llist_len(log_list))
- return fprintf(stderr, "[%s] %s\n", SDB_LOG_PRIO_TO_STRING(prio), msg);
-
iter = sdb_llist_get_iter(log_list);
while (sdb_llist_iter_has_next(iter)) {
sdb_plugin_log_cb callback;
tmp = callback(prio, msg, SDB_PLUGIN_CB(obj)->cb_user_data);
if (tmp > ret)
ret = tmp;
+
+ if (SDB_PLUGIN_CB(obj)->cb_ctx)
+ logged = 1;
+ /* else: this is an internally registered callback */
}
sdb_llist_iter_destroy(iter);
+
+ if (! logged)
+ return fprintf(stderr, "[%s] %s\n", SDB_LOG_PRIO_TO_STRING(prio), msg);
return ret;
} /* sdb_plugin_log */