Add logging to notification API error paths
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Wed, 1 Mar 2017 04:02:32 +0000 (23:02 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Wed, 1 Mar 2017 04:02:50 +0000 (23:02 -0500)
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
src/common/action.c
src/common/buffer-usage.c
src/common/condition.c
src/common/trigger.c

index 7deb509e3e09690ea6b0ede59c749eec0a8f3ec3..d07f36c2de77cfc6521fbc8dea367c730b337fc3 100644 (file)
@@ -17,6 +17,7 @@
 
 #include <lttng/action/action-internal.h>
 #include <lttng/action/notify-internal.h>
+#include <common/error.h>
 #include <assert.h>
 
 enum lttng_action_type lttng_action_get_type(struct lttng_action *action)
@@ -97,6 +98,7 @@ ssize_t lttng_action_create_from_buffer(const char *buf,
                goto end;
        }
 
+       DBG("Deserializing action from buffer");
        switch (action_comm->action_type) {
        case LTTNG_ACTION_TYPE_NOTIFY:
                action = lttng_action_notify_create();
index eed921a56a884e15bffb2d6cd3ab1af330bee97e..697967d8c3b92471a3b6d64577e82cc3b6e91481 100644 (file)
@@ -18,6 +18,7 @@
 #include <lttng/condition/condition-internal.h>
 #include <lttng/condition/buffer-usage-internal.h>
 #include <common/macros.h>
+#include <common/error.h>
 #include <assert.h>
 
 static
@@ -64,12 +65,15 @@ bool lttng_condition_buffer_usage_validate(struct lttng_condition *condition)
        usage = container_of(condition, struct lttng_condition_buffer_usage,
                        parent);
        if (!usage->session_name) {
+               ERR("Invalid buffer condition: a target session name must be set.");
                goto end;
        }
        if (!usage->channel_name) {
+               ERR("Invalid buffer condition: a target channel name must be set.");
                goto end;
        }
        if (!usage->threshold_percent.set && !usage->threshold_bytes.set) {
+               ERR("Invalid buffer condition: a threshold must be set.");
                goto end;
        }
 
@@ -91,6 +95,7 @@ ssize_t lttng_condition_buffer_usage_serialize(struct lttng_condition *condition
                goto end;
        }
 
+       DBG("Serializing buffer usage condition");
        usage = container_of(condition, struct lttng_condition_buffer_usage,
                        parent);
        size = sizeof(struct lttng_condition_buffer_usage_comm);
@@ -173,6 +178,7 @@ ssize_t init_from_buffer(struct lttng_condition *condition, const char *buf)
                                condition, condition_comm->threshold.percent);
        }
        if (status != LTTNG_CONDITION_STATUS_OK) {
+               ERR("Failed to initialize buffer usage condition threshold");
                ret = -1;
                goto end;
        }
@@ -180,6 +186,8 @@ ssize_t init_from_buffer(struct lttng_condition *condition, const char *buf)
        if (condition_comm->domain_type <= LTTNG_DOMAIN_NONE ||
                        condition_comm->domain_type > LTTNG_DOMAIN_PYTHON) {
                /* Invalid domain value. */
+               ERR("Invalid domain type value (%i) found in condition buffer",
+                               (int) condition_comm->domain_type);
                ret = -1;
                goto end;
        }
@@ -188,6 +196,7 @@ ssize_t init_from_buffer(struct lttng_condition *condition, const char *buf)
        status = lttng_condition_buffer_usage_set_domain_type(condition,
                        domain_type);
        if (status != LTTNG_CONDITION_STATUS_OK) {
+               ERR("Failed to set buffer usage condition domain");
                ret = -1;
                goto end;
        }
@@ -198,6 +207,7 @@ ssize_t init_from_buffer(struct lttng_condition *condition, const char *buf)
        status = lttng_condition_buffer_usage_set_session_name(condition,
                        session_name);
        if (status != LTTNG_CONDITION_STATUS_OK) {
+               ERR("Failed to set buffer usage session name");
                ret = -1;
                goto end;
        }
@@ -205,6 +215,7 @@ ssize_t init_from_buffer(struct lttng_condition *condition, const char *buf)
        status = lttng_condition_buffer_usage_set_channel_name(condition,
                        channel_name);
        if (status != LTTNG_CONDITION_STATUS_OK) {
+               ERR("Failed to set buffer usage channel name");
                ret = -1;
                goto end;
        }
@@ -235,6 +246,7 @@ ssize_t lttng_condition_buffer_usage_low_create_from_buffer(const char *buf,
                goto error;
        }
 
+       DBG("Initializing low buffer usage condition from buffer");
        ret = init_from_buffer(condition, buf);
        if (ret < 0) {
                goto error;
@@ -260,6 +272,7 @@ ssize_t lttng_condition_buffer_usage_high_create_from_buffer(const char *buf,
                goto error;
        }
 
+       DBG("Initializing high buffer usage condition from buffer");
        ret = init_from_buffer(condition, buf);
        if (ret < 0) {
                goto error;
index 9f9795d5511446b04edd15f18864f29c6e808cb0..5c3c11c237570d3039feb1a01ca3464cb1ef66f1 100644 (file)
@@ -18,6 +18,7 @@
 #include <lttng/condition/condition-internal.h>
 #include <lttng/condition/buffer-usage-internal.h>
 #include <common/macros.h>
+#include <common/error.h>
 #include <stdbool.h>
 #include <assert.h>
 
@@ -99,6 +100,7 @@ ssize_t lttng_condition_create_from_buffer(const char *buf,
                goto end;
        }
 
+       DBG("Deserializing condition from buffer");
        condition_size += sizeof(*condition_comm);
        buf += condition_size;
 
@@ -120,6 +122,8 @@ ssize_t lttng_condition_create_from_buffer(const char *buf,
                condition_size += ret;
                break;
        default:
+               ERR("Attempted to create condition of unknown type (%i)",
+                               (int) condition_comm->condition_type);
                ret = -1;
                goto end;
        }
index 1d79a61a578fe8c6fdd4f3c92ad05ecd4e45343d..12a7329f4492396db302e7db36868d1f86c89ab9 100644 (file)
@@ -18,6 +18,7 @@
 #include <lttng/trigger/trigger-internal.h>
 #include <lttng/condition/condition-internal.h>
 #include <lttng/action/action-internal.h>
+#include <common/error.h>
 #include <assert.h>
 
 LTTNG_HIDDEN
@@ -81,6 +82,7 @@ ssize_t lttng_trigger_create_from_buffer(const char *buf,
                goto end;
        }
 
+       DBG("Deserializing trigger from buffer");
        ret = lttng_condition_create_from_buffer(buf, &condition);
        if (ret < 0) {
                goto end;
This page took 0.029245 seconds and 5 git commands to generate.