* SOFTWARE.
*/
+#define BT_COMP_LOG_SELF_COMP (fs_sink->self_comp)
#define BT_LOG_OUTPUT_LEVEL (fs_sink->log_level)
#define BT_LOG_TAG "PLUGIN/SINK.CTF.FS"
-#include "logging/log.h"
+#include "plugins/comp-logging.h"
#include <babeltrace2/babeltrace.h>
#include <stdio.h>
ret = g_mkdir_with_parents(fs_sink->output_dir_path->str, 0755);
if (ret) {
- BT_LOGE_ERRNO("Cannot create directories for output directory",
+ BT_COMP_LOGE_ERRNO(
+ "Cannot create directories for output directory",
": output-dir-path=\"%s\"",
fs_sink->output_dir_path->str);
status = BT_SELF_COMPONENT_STATUS_ERROR;
value = bt_value_map_borrow_entry_value_const(params, "path");
if (!value) {
- BT_LOGE_STR("Missing mandatory `path` parameter.");
+ BT_COMP_LOGE_STR("Missing mandatory `path` parameter.");
status = BT_SELF_COMPONENT_STATUS_ERROR;
goto end;
}
if (!bt_value_is_string(value)) {
- BT_LOGE_STR("`path` parameter: expecting a string.");
+ BT_COMP_LOGE_STR("`path` parameter: expecting a string.");
status = BT_SELF_COMPONENT_STATUS_ERROR;
goto end;
}
"assume-single-trace");
if (value) {
if (!bt_value_is_bool(value)) {
- BT_LOGE_STR("`assume-single-trace` parameter: expecting a boolean.");
+ BT_COMP_LOGE_STR("`assume-single-trace` parameter: expecting a boolean.");
status = BT_SELF_COMPONENT_STATUS_ERROR;
goto end;
}
"ignore-discarded-events");
if (value) {
if (!bt_value_is_bool(value)) {
- BT_LOGE_STR("`ignore-discarded-events` parameter: expecting a boolean.");
+ BT_COMP_LOGE_STR("`ignore-discarded-events` parameter: expecting a boolean.");
status = BT_SELF_COMPONENT_STATUS_ERROR;
goto end;
}
"ignore-discarded-packets");
if (value) {
if (!bt_value_is_bool(value)) {
- BT_LOGE_STR("`ignore-discarded-packets` parameter: expecting a boolean.");
+ BT_COMP_LOGE_STR("`ignore-discarded-packets` parameter: expecting a boolean.");
status = BT_SELF_COMPONENT_STATUS_ERROR;
goto end;
}
"quiet");
if (value) {
if (!bt_value_is_bool(value)) {
- BT_LOGE_STR("`quiet` parameter: expecting a boolean.");
+ BT_COMP_LOGE_STR("`quiet` parameter: expecting a boolean.");
status = BT_SELF_COMPONENT_STATUS_ERROR;
goto end;
}
fs_sink = g_new0(struct fs_sink_comp, 1);
if (!fs_sink) {
- BT_LOG_WRITE_CUR_LVL(BT_LOG_ERROR, log_level, BT_LOG_TAG,
+ BT_COMP_LOG_CUR_LVL(BT_LOG_ERROR, log_level, self_comp,
"Failed to allocate one CTF FS sink structure.");
status = BT_SELF_COMPONENT_STATUS_NOMEM;
goto end;
}
fs_sink->log_level = log_level;
+ fs_sink->self_comp = self_comp;
fs_sink->output_dir_path = g_string_new(NULL);
- fs_sink->self_comp = self_comp_sink;
status = configure_component(fs_sink, params);
if (status != BT_SELF_COMPONENT_STATUS_OK) {
/* configure_component() logs errors */
if (fs_sink->assume_single_trace &&
g_file_test(fs_sink->output_dir_path->str,
G_FILE_TEST_EXISTS)) {
- BT_LOGE("Single trace mode, but output path exists: "
+ BT_COMP_LOGE("Single trace mode, but output path exists: "
"output-path=\"%s\"", fs_sink->output_dir_path->str);
status = BT_SELF_COMPONENT_STATUS_ERROR;
goto end;
fs_sink->traces = g_hash_table_new_full(g_direct_hash, g_direct_equal,
NULL, (GDestroyNotify) fs_sink_trace_destroy);
if (!fs_sink->traces) {
- BT_LOGE_STR("Failed to allocate one GHashTable.");
+ BT_COMP_LOGE_STR("Failed to allocate one GHashTable.");
status = BT_SELF_COMPONENT_STATUS_NOMEM;
goto end;
}
if (G_UNLIKELY(!trace)) {
if (fs_sink->assume_single_trace &&
g_hash_table_size(fs_sink->traces) > 0) {
- BT_LOGE("Single trace mode, but getting more than one trace: "
+ BT_COMP_LOGE("Single trace mode, but getting more than one trace: "
"stream-name=\"%s\"",
bt_stream_get_name(ir_stream));
goto end;
goto end;
}
- ret = try_translate_event_class_trace_ir_to_ctf_ir(stream->sc,
- bt_event_borrow_class_const(ir_event), &ec,
- fs_sink->log_level);
+ ret = try_translate_event_class_trace_ir_to_ctf_ir(fs_sink,
+ stream->sc, bt_event_borrow_class_const(ir_event), &ec);
if (ret) {
status = BT_SELF_COMPONENT_STATUS_ERROR;
goto end;
if (stream->discarded_events_state.beginning_cs !=
expected_cs) {
- BT_LOGE("Incompatible discarded events message: "
+ BT_COMP_LOGE("Incompatible discarded events message: "
"unexpected beginning time: "
"beginning-cs-val=%" PRIu64 ", "
"expected-beginning-cs-val=%" PRIu64 ", "
* this case.
*/
if (stream->prev_packet_state.end_cs == UINT64_C(-1)) {
- BT_LOGE("Incompatible discarded packets message "
+ BT_COMP_LOGE("Incompatible discarded packets message "
"occuring before the stream's first packet: "
"stream-id=%" PRIu64 ", stream-name=\"%s\", "
"trace-name=\"%s\", path=\"%s/%s\"",
if (stream->discarded_packets_state.beginning_cs !=
stream->prev_packet_state.end_cs) {
- BT_LOGE("Incompatible discarded packets message: "
+ BT_COMP_LOGE("Incompatible discarded packets message: "
"unexpected beginning time: "
"beginning-cs-val=%" PRIu64 ", "
"expected-beginning-cs-val=%" PRIu64 ", "
if (stream->discarded_packets_state.end_cs !=
expected_end_cs) {
- BT_LOGE("Incompatible discarded packets message: "
+ BT_COMP_LOGE("Incompatible discarded packets message: "
"unexpected end time: "
"end-cs-val=%" PRIu64 ", "
"expected-end-cs-val=%" PRIu64 ", "
expected_cs = bt_clock_snapshot_get_value(cs);
if (stream->discarded_events_state.end_cs != expected_cs) {
- BT_LOGE("Incompatible discarded events message: "
+ BT_COMP_LOGE("Incompatible discarded events message: "
"unexpected end time: "
"end-cs-val=%" PRIu64 ", "
"expected-end-cs-val=%" PRIu64 ", "
if (!fs_sink->ignore_discarded_events &&
bt_stream_class_discarded_events_have_default_clock_snapshots(ir_sc) &&
!packets_have_beginning_end_cs) {
- BT_LOGE("Unsupported stream: discarded events have "
+ BT_COMP_LOGE("Unsupported stream: discarded events have "
"default clock snapshots, but packets have no "
"beginning and/or end default clock snapshots: "
"stream-addr=%p, "
if (!fs_sink->ignore_discarded_packets &&
bt_stream_class_discarded_packets_have_default_clock_snapshots(ir_sc) &&
!packets_have_beginning_end_cs) {
- BT_LOGE("Unsupported stream: discarded packets have "
+ BT_COMP_LOGE("Unsupported stream: discarded packets have "
"default clock snapshots, but packets have no "
"beginning and/or end default clock snapshots: "
"stream-addr=%p, "
goto end;
}
- BT_LOGI("Created new, empty stream file: "
+ BT_COMP_LOGI("Created new, empty stream file: "
"stream-id=%" PRIu64 ", stream-name=\"%s\", "
"trace-name=\"%s\", path=\"%s/%s\"",
bt_stream_get_id(ir_stream), bt_stream_get_name(ir_stream),
goto end;
}
- BT_LOGI("Closing stream file: "
+ BT_COMP_LOGI("Closing stream file: "
"stream-id=%" PRIu64 ", stream-name=\"%s\", "
"trace-name=\"%s\", path=\"%s/%s\"",
bt_stream_get_id(ir_stream), bt_stream_get_name(ir_stream),
}
if (fs_sink->ignore_discarded_events) {
- BT_LOGI("Ignoring discarded events message: "
+ BT_COMP_LOGI("Ignoring discarded events message: "
"stream-id=%" PRIu64 ", stream-name=\"%s\", "
"trace-name=\"%s\", path=\"%s/%s\"",
bt_stream_get_id(ir_stream),
}
if (stream->discarded_events_state.in_range) {
- BT_LOGE("Unsupported contiguous discarded events message: "
+ BT_COMP_LOGE("Unsupported contiguous discarded events message: "
"stream-id=%" PRIu64 ", stream-name=\"%s\", "
"trace-name=\"%s\", path=\"%s/%s\"",
bt_stream_get_id(ir_stream),
*/
if (stream->packet_state.is_open &&
stream->sc->discarded_events_has_ts) {
- BT_LOGE("Unsupported discarded events message with "
+ BT_COMP_LOGE("Unsupported discarded events message with "
"default clock snapshots occuring within a packet: "
"stream-id=%" PRIu64 ", stream-name=\"%s\", "
"trace-name=\"%s\", path=\"%s/%s\"",
}
if (fs_sink->ignore_discarded_packets) {
- BT_LOGI("Ignoring discarded packets message: "
+ BT_COMP_LOGI("Ignoring discarded packets message: "
"stream-id=%" PRIu64 ", stream-name=\"%s\", "
"trace-name=\"%s\", path=\"%s/%s\"",
bt_stream_get_id(ir_stream),
}
if (stream->discarded_packets_state.in_range) {
- BT_LOGE("Unsupported contiguous discarded packets message: "
+ BT_COMP_LOGE("Unsupported contiguous discarded packets message: "
"stream-id=%" PRIu64 ", stream-name=\"%s\", "
"trace-name=\"%s\", path=\"%s/%s\"",
bt_stream_get_id(ir_stream),
break;
case BT_MESSAGE_TYPE_MESSAGE_ITERATOR_INACTIVITY:
/* Ignore */
- BT_LOGD_STR("Ignoring message iterator inactivity message.");
+ BT_COMP_LOGD_STR("Ignoring message iterator inactivity message.");
break;
case BT_MESSAGE_TYPE_STREAM_BEGINNING:
status = handle_stream_beginning_msg(
case BT_MESSAGE_TYPE_STREAM_ACTIVITY_BEGINNING:
case BT_MESSAGE_TYPE_STREAM_ACTIVITY_END:
/* Not supported by CTF 1.8 */
- BT_LOGD_STR("Ignoring stream activity message.");
+ BT_COMP_LOGD_STR("Ignoring stream activity message.");
break;
case BT_MESSAGE_TYPE_DISCARDED_EVENTS:
status = handle_discarded_events_msg(
BT_MESSAGE_PUT_REF_AND_RESET(msgs[i]);
if (status != BT_SELF_COMPONENT_STATUS_OK) {
- BT_LOGE("Failed to handle message: "
+ BT_COMP_LOGE("Failed to handle message: "
"generated CTF traces could be incomplete: "
"output-dir-path=\"%s\"",
fs_sink->output_dir_path->str);