* SOFTWARE.
*/
-#define BT_LOG_TAG "PLUGIN-CTF-LTTNG-LIVE-SRC-VIEWER"
-#include "logging.h"
+#define BT_LOG_OUTPUT_LEVEL (viewer_connection->log_level)
+#define BT_LOG_TAG "PLUGIN/SRC.CTF.LTTNG-LIVE/VIEWER"
+#include "logging/log.h"
#include <stdio.h>
#include <stdint.h>
lttng_live_url_parts.session_name = NULL;
}
- BT_LOGD("Connecting to hostname : %s, port : %d, "
+ BT_LOGI("Connecting to hostname : %s, port : %d, "
"target hostname : %s, session name : %s, "
"proto : %s",
viewer_connection->relay_hostname->str,
}
BT_ASSERT(ret_len == sizeof(connect));
- BT_LOGD("Received viewer session ID : %" PRIu64,
+ BT_LOGI("Received viewer session ID : %" PRIu64,
(uint64_t) be64toh(connect.viewer_session_id));
- BT_LOGD("Relayd version : %u.%u", be32toh(connect.major),
+ BT_LOGI("Relayd version : %u.%u", be32toh(connect.major),
be32toh(connect.minor));
if (LTTNG_LIVE_MAJOR != be32toh(connect.major)) {
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;
}
val = bt_value_signed_integer_get(btval);
/* max */
- val = max_t(int64_t, clients, val);
+ val = bt_max_t(int64_t, clients, val);
bt_value_signed_integer_set(btval, val);
}
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;
}
lsession.session_name[LTTNG_VIEWER_NAME_MAX - 1] = '\0';
session_id = be64toh(lsession.id);
- BT_LOGD("Adding session %" PRIu64 " hostname: %s session_name: %s",
+ BT_LOGI("Adding session %" PRIu64 " hostname: %s session_name: %s",
session_id, lsession.hostname, lsession.session_name);
if ((strncmp(lsession.session_name,
struct live_viewer_connection *viewer_connection =
lttng_live_msg_iter->viewer_connection;
- BT_LOGD("Getting %" PRIu32 " new streams:", stream_count);
+ BT_LOGI("Getting %" PRIu32 " new streams:", stream_count);
for (i = 0; i < stream_count; i++) {
struct lttng_viewer_stream stream;
struct lttng_live_stream_iterator *live_stream;
ctf_trace_id = be64toh(stream.ctf_trace_id);
if (stream.metadata_flag) {
- BT_LOGD(" metadata stream %" PRIu64 " : %s/%s",
+ BT_LOGI(" metadata stream %" PRIu64 " : %s/%s",
stream_id, stream.path_name,
stream.channel_name);
if (lttng_live_metadata_create_stream(session,
}
session->lazy_stream_msg_init = true;
} else {
- BT_LOGD(" stream %" PRIu64 " : %s/%s",
+ BT_LOGI(" stream %" PRIu64 " : %s/%s",
stream_id, stream.path_name,
stream.channel_name);
live_stream = lttng_live_stream_iterator_create(session,
goto error;
}
- data = zmalloc(len);
+ data = calloc(1, len);
if (!data) {
- BT_LOGE("relay data zmalloc: %s", strerror(errno));
+ BT_LOGE("relay data calloc: %s", strerror(errno));
goto error;
}
ret_len = lttng_live_recv(viewer_connection, data, len);
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;
goto error;
}
- BT_LOGD("Establishing connection to url \"%s\"...", url);
+ BT_LOGI("Establishing connection to url \"%s\"...", url);
if (lttng_live_connect_viewer(viewer_connection)) {
goto error_report;
}
- BT_LOGD("Connection to url \"%s\" is established", url);
+ BT_LOGI("Connection to url \"%s\" is established", url);
return viewer_connection;
error_report:
void live_viewer_connection_destroy(
struct live_viewer_connection *viewer_connection)
{
- BT_LOGD("Closing connection to url \"%s\"", viewer_connection->url->str);
+ BT_LOGI("Closing connection to url \"%s\"", viewer_connection->url->str);
lttng_live_disconnect_viewer(viewer_connection);
g_string_free(viewer_connection->url, true);
if (viewer_connection->relay_hostname) {