"BABELTRACE_SINK_CTF_FS_LOG_LEVEL",
"BABELTRACE_SINK_TEXT_DETAILS_LOG_LEVEL",
"BABELTRACE_SRC_CTF_FS_LOG_LEVEL",
- "BABELTRACE_SRC_CTF_LTTNG_LIVE_LOG_LEVEL",
NULL,
};
metadata.h \
viewer-connection.c \
viewer-connection.h \
- lttng-viewer-abi.h \
- logging.c \
- logging.h
+ lttng-viewer-abi.h
if BABELTRACE_BUILD_WITH_MINGW
libbabeltrace2_plugin_ctf_lttng_live_la_LIBADD = -lws2_32
* SOFTWARE.
*/
+#define BT_LOG_OUTPUT_LEVEL log_level
#define BT_LOG_TAG "PLUGIN/SRC.CTF.LTTNG-LIVE/DS"
-#include "logging.h"
+#include "logging/log.h"
#include <stdio.h>
#include <stdint.h>
int64_t stream_id, void *data)
{
struct lttng_live_stream_iterator *lttng_live_stream = data;
+ bt_logging_level log_level = lttng_live_stream->log_level;
if (!lttng_live_stream->stream) {
uint64_t stream_class_id = bt_stream_class_get_id(stream_class);
struct lttng_live_component *lttng_live =
session->lttng_live_msg_iter->lttng_live_comp;
uint64_t trace_idx, stream_iter_idx;
+ bt_logging_level log_level = session->log_level;
if (!session->lazy_stream_msg_init) {
return LTTNG_LIVE_ITERATOR_STATUS_OK;
trace->metadata->decoder);
stream_iter->msg_iter = bt_msg_iter_create(ctf_tc,
lttng_live->max_query_size, medops,
- stream_iter, BT_LOG_OUTPUT_LEVEL);
+ stream_iter, log_level);
if (!stream_iter->msg_iter) {
goto error;
}
struct lttng_live_stream_iterator *stream_iter;
struct lttng_live_component *lttng_live;
struct lttng_live_trace *trace;
+ bt_logging_level log_level;
BT_ASSERT(session);
BT_ASSERT(session->lttng_live_msg_iter);
BT_ASSERT(session->lttng_live_msg_iter->lttng_live_comp);
+ log_level = session->log_level;
lttng_live = session->lttng_live_msg_iter->lttng_live_comp;
goto error;
}
+ stream_iter->log_level = log_level;
trace = lttng_live_borrow_trace(session, ctf_trace_id);
if (!trace) {
goto error;
BT_ASSERT(!stream_iter->msg_iter);
stream_iter->msg_iter = bt_msg_iter_create(ctf_tc,
lttng_live->max_query_size, medops,
- stream_iter, BT_LOG_OUTPUT_LEVEL);
+ stream_iter, log_level);
if (!stream_iter->msg_iter) {
goto error;
}
+++ /dev/null
-/*
- * Copyright (c) 2017 Philippe Proulx <pproulx@efficios.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-#define BT_LOG_OUTPUT_LEVEL lttng_live_log_level
-#include "logging/log.h"
-
-BT_LOG_INIT_LOG_LEVEL(lttng_live_log_level, "BABELTRACE_SRC_CTF_LTTNG_LIVE_LOG_LEVEL");
+++ /dev/null
-#ifndef LTTNG_LIVE_LOGGING_H
-#define LTTNG_LIVE_LOGGING_H
-
-/*
- * Copyright (c) 2017 Philippe Proulx <pproulx@efficios.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-#define BT_LOG_OUTPUT_LEVEL lttng_live_log_level
-#include "logging/log.h"
-
-BT_LOG_LEVEL_EXTERN_SYMBOL(lttng_live_log_level);
-
-#endif /* LTTNG_LIVE_LOGGING_H */
* SOFTWARE.
*/
+#define BT_LOG_OUTPUT_LEVEL log_level
#define BT_LOG_TAG "PLUGIN/SRC.CTF.LTTNG-LIVE"
-#include "logging.h"
+#include "logging/log.h"
#include <glib.h>
#include <inttypes.h>
static
void lttng_live_destroy_trace(struct lttng_live_trace *trace)
{
+ bt_logging_level log_level = trace->log_level;
+
BT_LOGD("Destroy lttng_live_trace");
BT_ASSERT(trace->stream_iterators);
uint64_t trace_id)
{
struct lttng_live_trace *trace = NULL;
+ bt_logging_level log_level = session->log_level;
trace = g_new0(struct lttng_live_trace, 1);
if (!trace) {
goto error;
}
+ trace->log_level = session->log_level;
trace->session = session;
trace->id = trace_id;
trace->trace_class = NULL;
{
int ret = 0;
struct lttng_live_session *session;
+ bt_logging_level log_level = lttng_live_msg_iter->log_level;
session = g_new0(struct lttng_live_session, 1);
if (!session) {
goto error;
}
+ session->log_level = lttng_live_msg_iter->log_level;
session->id = session_id;
session->traces = g_ptr_array_new_with_free_func(
(GDestroyNotify) lttng_live_destroy_trace);
void lttng_live_destroy_session(struct lttng_live_session *session)
{
struct lttng_live_component *live_comp;
+ bt_logging_level log_level;
if (!session) {
goto end;
}
+ log_level = session->log_level;
BT_LOGD("Destroy lttng live session");
if (session->id != -1ULL) {
if (lttng_live_detach_session(session)) {
enum lttng_live_iterator_status lttng_live_iterator_next_check_stream_state(
struct lttng_live_stream_iterator *lttng_live_stream)
{
+ bt_logging_level log_level = lttng_live_stream->log_level;
+
switch (lttng_live_stream->state) {
case LTTNG_LIVE_STREAM_QUIESCENT:
case LTTNG_LIVE_STREAM_ACTIVE_DATA:
struct lttng_live_msg_iter *lttng_live_msg_iter,
struct lttng_live_stream_iterator *lttng_live_stream)
{
+ bt_logging_level log_level = lttng_live_msg_iter->log_level;
enum lttng_live_iterator_status ret =
LTTNG_LIVE_ITERATOR_STATUS_OK;
struct packet_index index;
const bt_clock_snapshot *clock_snapshot = NULL;
int ret = 0;
bt_message_stream_activity_clock_snapshot_state sa_cs_state;
+ bt_logging_level log_level = lttng_live_msg_iter->log_level;
BT_ASSERT(msg);
BT_ASSERT(ts_ns);
enum lttng_live_iterator_status ret = LTTNG_LIVE_ITERATOR_STATUS_OK;
enum bt_msg_iter_status status;
uint64_t session_idx, trace_idx;
+ bt_logging_level log_level = lttng_live_msg_iter->log_level;
for (session_idx = 0; session_idx < lttng_live_msg_iter->sessions->len;
session_idx++) {
struct lttng_live_stream_iterator *stream_iter,
bt_message **curr_msg)
{
+ bt_logging_level log_level = lttng_live_msg_iter->log_level;
enum lttng_live_iterator_status live_status;
retry:
enum lttng_live_iterator_status stream_iter_status;;
int64_t curr_candidate_msg_ts = INT64_MAX;
uint64_t stream_iter_idx;
+ bt_logging_level log_level = lttng_live_msg_iter->log_level;
BT_ASSERT(live_trace);
BT_ASSERT(live_trace->stream_iterators);
bt_self_component_source_as_self_component(self_comp_src);
struct lttng_live_component *lttng_live;
struct lttng_live_msg_iter *lttng_live_msg_iter;
+ bt_logging_level log_level;
BT_ASSERT(self_msg_it);
lttng_live = bt_self_component_get_data(self_comp);
+ log_level = lttng_live->log_level;
/* There can be only one downstream iterator at the same time. */
BT_ASSERT(!lttng_live->has_msg_iter);
goto end;
}
+ lttng_live_msg_iter->log_level = lttng_live->log_level;
lttng_live_msg_iter->lttng_live_comp = lttng_live;
lttng_live_msg_iter->self_msg_iter = self_msg_it;
static
bt_query_status lttng_live_query_list_sessions(const bt_value *params,
- const bt_value **result)
+ const bt_value **result, bt_logging_level log_level)
{
bt_query_status status = BT_QUERY_STATUS_OK;
const bt_value *url_value = NULL;
bt_query_status lttng_live_query(bt_self_component_class_source *comp_class,
const bt_query_executor *query_exec,
const char *object, const bt_value *params,
- __attribute__((unused)) bt_logging_level log_level,
- const bt_value **result)
+ bt_logging_level log_level, const bt_value **result)
{
bt_query_status status = BT_QUERY_STATUS_OK;
if (strcmp(object, "sessions") == 0) {
- status = lttng_live_query_list_sessions(params, result);
+ status = lttng_live_query_list_sessions(params, result,
+ log_level);
} else {
BT_LOGW("Unknown query object `%s`", object);
status = BT_QUERY_STATUS_INVALID_OBJECT;
return action;
}
-struct lttng_live_component *lttng_live_component_create(const bt_value *params)
+struct lttng_live_component *lttng_live_component_create(const bt_value *params,
+ bt_logging_level log_level)
{
struct lttng_live_component *lttng_live;
const bt_value *value = NULL;
if (!lttng_live) {
goto end;
}
+ lttng_live->log_level = log_level;
lttng_live->max_query_size = MAX_QUERY_SIZE;
lttng_live->has_msg_iter = false;
BT_HIDDEN
bt_self_component_status lttng_live_component_init(
- bt_self_component_source *self_comp,
+ bt_self_component_source *self_comp_src,
const bt_value *params, __attribute__((unused)) void *init_method_data)
{
struct lttng_live_component *lttng_live;
bt_self_component_status ret = BT_SELF_COMPONENT_STATUS_OK;
+ bt_self_component *self_comp =
+ bt_self_component_source_as_self_component(self_comp_src);
+ bt_logging_level log_level = bt_component_get_logging_level(
+ bt_self_component_as_component(self_comp));
- lttng_live = lttng_live_component_create(params);
+ lttng_live = lttng_live_component_create(params, log_level);
if (!lttng_live) {
ret = BT_SELF_COMPONENT_STATUS_NOMEM;
goto error;
}
- lttng_live->self_comp = self_comp;
+ lttng_live->self_comp = self_comp_src;
if (lttng_live_graph_is_canceled(lttng_live)) {
ret = BT_SELF_COMPONENT_STATUS_END;
goto error;
}
- bt_self_component_set_data(
- bt_self_component_source_as_self_component(self_comp),
- lttng_live);
+ bt_self_component_set_data(self_comp, lttng_live);
goto end;
error:
/* Iterator over a live stream. */
struct lttng_live_stream_iterator {
+ bt_logging_level log_level;
+
/* Owned by this. */
bt_stream *stream;
};
struct lttng_live_metadata {
+ bt_logging_level log_level;
+
/* Weak reference. */
struct lttng_live_trace *trace;
};
struct lttng_live_trace {
+ bt_logging_level log_level;
+
/* Back reference to session. */
struct lttng_live_session *session;
};
struct lttng_live_session {
+ bt_logging_level log_level;
+
/* Weak reference. */
struct lttng_live_msg_iter *lttng_live_msg_iter;
* A component instance is an iterator on a single session.
*/
struct lttng_live_component {
+ bt_logging_level log_level;
+
/* Weak reference. */
bt_self_component_source *self_comp;
};
struct lttng_live_msg_iter {
+ bt_logging_level log_level;
+
/* Weak reference. */
struct lttng_live_component *lttng_live_comp;
* SOFTWARE.
*/
+#define BT_LOG_OUTPUT_LEVEL log_level
#define BT_LOG_TAG "PLUGIN/SRC.CTF.LTTNG-LIVE/META"
-#include "logging.h"
+#include "logging/log.h"
#include <stdio.h>
#include <stdint.h>
static
-bool stream_classes_all_have_default_clock_class(bt_trace_class *tc)
+bool stream_classes_all_have_default_clock_class(bt_trace_class *tc,
+ bt_logging_level log_level)
{
uint64_t i, sc_count;
const bt_clock_class *cc = NULL;
enum ctf_metadata_decoder_status decoder_status;
enum lttng_live_iterator_status status =
LTTNG_LIVE_ITERATOR_STATUS_OK;
+ bt_logging_level log_level = trace->log_level;
/* No metadata stream yet. */
if (!metadata) {
metadata->decoder);
trace->trace = bt_trace_create(trace->trace_class);
if (!stream_classes_all_have_default_clock_class(
- trace->trace_class)) {
+ trace->trace_class, log_level)) {
/* Error logged in function. */
goto error;
}
struct lttng_live_trace *trace;
const char *match;
struct ctf_metadata_decoder_config cfg = {
- .log_level = BT_LOG_OUTPUT_LEVEL,
+ .log_level = session->log_level,
.clock_class_offset_s = 0,
.clock_class_offset_ns = 0,
};
if (!metadata) {
return -1;
}
+ metadata->log_level = session->log_level;
metadata->stream_id = stream_id;
match = strstr(trace_name, session->session_name->str);
* SOFTWARE.
*/
+#define BT_LOG_OUTPUT_LEVEL (viewer_connection->log_level)
#define BT_LOG_TAG "PLUGIN/SRC.CTF.LTTNG-LIVE/VIEWER"
-#include "logging.h"
+#include "logging/log.h"
#include <stdio.h>
#include <stdint.h>
static
int list_update_session(bt_value *results,
const struct lttng_viewer_session *session,
- bool *_found)
+ bool *_found, struct live_viewer_connection *viewer_connection)
{
int ret = 0;
bt_value *map = NULL;
static
int list_append_session(bt_value *results,
GString *base_url,
- const struct lttng_viewer_session *session)
+ const struct lttng_viewer_session *session,
+ struct live_viewer_connection *viewer_connection)
{
int ret = 0;
bt_value_status ret_status;
* If the session already exists, add the stream count to it,
* and do max of client counts.
*/
- ret = list_update_session(results, session, &found);
+ ret = list_update_session(results, session, &found, viewer_connection);
if (ret || found) {
goto end;
}
lsession.hostname[LTTNG_VIEWER_HOST_NAME_MAX - 1] = '\0';
lsession.session_name[LTTNG_VIEWER_NAME_MAX - 1] = '\0';
if (list_append_session(result, viewer_connection->url,
- &lsession)) {
+ &lsession, viewer_connection)) {
status = BT_QUERY_STATUS_ERROR;
goto error;
}
goto error;
}
+ viewer_connection->log_level = lttng_live_msg_iter->log_level;
bt_object_init_shared(&viewer_connection->obj, connection_release);
viewer_connection->control_sock = BT_INVALID_SOCKET;
viewer_connection->port = -1;
#include "common/macros.h"
#include "compat/socket.h"
-//TODO: this should not be used by plugins. Should copy code into plugin
-//instead.
+/*
+ * FIXME: This is an internal Babeltrace library header; it is not meant
+ * to be generic as it is now. Make sure this included code does not
+ * log because it won't find our local log level.
+ */
+#define BT_OBJECT_DONT_LOG
#include "lib/object.h"
#define LTTNG_DEFAULT_NETWORK_VIEWER_PORT 5344
struct lttng_live_component;
struct live_viewer_connection {
+ bt_logging_level log_level;
bt_object obj;
GString *url;