summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: f7e26c2)
raw | patch | inline | side by side (parent: f7e26c2)
author | Florian Forster <octo@collectd.org> | |
Sun, 6 Nov 2016 21:17:02 +0000 (22:17 +0100) | ||
committer | Florian Forster <octo@collectd.org> | |
Sun, 6 Nov 2016 21:17:05 +0000 (22:17 +0100) |
Use rd_kafka_set_logger() only when rd_kafka_conf_set_log_cb() is not
available:
write_kafka.c: In function 'kafka_handle':
write_kafka.c:119:6: error: 'rd_kafka_set_logger' is deprecated (declared at /usr/local/include/librdkafka/rdkafka.h:2400) [-Werror=deprecated-declarations]
rd_kafka_set_logger(ctx->kafka, kafka_log);
^
Fixes: #2029
available:
write_kafka.c: In function 'kafka_handle':
write_kafka.c:119:6: error: 'rd_kafka_set_logger' is deprecated (declared at /usr/local/include/librdkafka/rdkafka.h:2400) [-Werror=deprecated-declarations]
rd_kafka_set_logger(ctx->kafka, kafka_log);
^
Fixes: #2029
configure.ac | patch | blob | history | |
src/write_kafka.c | patch | blob | history |
diff --git a/configure.ac b/configure.ac
index c07687d2cbc59a9dbfeb8a987d647a7efdcbda0a..7748be86c84c505b812172543d04871233731f42 100644 (file)
--- a/configure.ac
+++ b/configure.ac
if test "x$with_librdkafka_log_cb" = "xyes"
then
AC_DEFINE(HAVE_LIBRDKAFKA_LOG_CB, 1, [Define if librdkafka log facility is present and usable.])
- fi
- if test "x$with_librdkafka_logger" = "xyes"
+ else if test "x$with_librdkafka_logger" = "xyes"
then
AC_DEFINE(HAVE_LIBRDKAFKA_LOGGER, 1, [Define if librdkafka log facility is present and usable.])
- fi
+ fi; fi
fi
CPPFLAGS="$SAVE_CPPFLAGS"
LDFLAGS="$SAVE_LDFLAGS"
diff --git a/src/write_kafka.c b/src/write_kafka.c
index 424acac95044f4f5c0bac57b52d5b772ddbe19c9..eaaf171262bd0b06ef07e0ddb8e32056bb9d873b 100644 (file)
--- a/src/write_kafka.c
+++ b/src/write_kafka.c
*/
#include "collectd.h"
+
#include "plugin.h"
#include "common.h"
#include "configfile.h"
static int32_t kafka_partition(const rd_kafka_topic_t *, const void *, size_t,
int32_t, void *, void *);
-#if defined HAVE_LIBRDKAFKA_LOGGER || defined HAVE_LIBRDKAFKA_LOG_CB
+/* Version 0.9.0 of librdkafka deprecates rd_kafka_set_logger() in favor of
+ * rd_kafka_conf_set_log_cb(). This is to make sure we're not using the
+ * deprecated function. */
+#ifdef HAVE_LIBRDKAFKA_LOG_CB
+# undef HAVE_LIBRDKAFKA_LOGGER
+#endif
+
+#if defined(HAVE_LIBRDKAFKA_LOGGER) || defined(HAVE_LIBRDKAFKA_LOG_CB)
static void kafka_log(const rd_kafka_t *, int, const char *, const char *);
static void kafka_log(const rd_kafka_t *rkt, int level,