Class DataLoggerResource
Defined in File data_logger.hpp
Base Types
public holoscan::DataLogger
(Class DataLogger)public holoscan::Resource
(Class Resource)
Derived Type
public holoscan::data_loggers::BasicConsoleLogger
(Class BasicConsoleLogger)
-
class DataLoggerResource : public holoscan::DataLogger, public holoscan::Resource
Subclassed by holoscan::data_loggers::BasicConsoleLogger
Public Functions
-
template<typename ArgT, typename ...ArgsT, typename = std::enable_if_t<!std::is_base_of_v<::holoscan::Resource, std::decay_t<ArgT>> && (std::is_same_v<::holoscan::Arg, std::decay_t<ArgT>> || std::is_same_v<::holoscan::ArgList, std::decay_t<ArgT>>)>>
inline explicit DataLoggerResource(ArgT &&arg, ArgsT&&... args)
-
DataLoggerResource() = default
-
~DataLoggerResource() override = default
-
virtual void setup(ComponentSpec &spec) override
Defines parameters for the logging resource, including the serializer.
- Parameters
spec – The component specification.
Logs a message.
The unique_id for the message will have the form:
operator_name.port_name
operator_name.port_name:index (for multi-receivers with N:1 connection)
For distributed applications, the fragment name will also appear in the unique id:
fragment_name.operator_name.port_name
fragment_name.operator_name.port_name:index
- Parameters
data – The data to log, passed as std::any.
unique_id – A unique identifier for the message.
acquisition_timestamp – Timestamp when the data was acquired (-1 if unknown).
metadata – Associated metadata dictionary for the message.
io_type – The type of I/O port (kInput or kOutput).
- Returns
true if logging (including serialization and sending) was successful, false otherwise.
Logs a Tensor with optional data content logging.
This specialized method allows efficient logging of tensor metadata without the overhead of logging large tensor data arrays when only header information is needed.
The unique_id for the message will have the form:
operator_name.port_name
operator_name.port_name:index (for multi-receivers with N:1 connection)
For distributed applications, the fragment name will also appear in the unique id:
fragment_name.operator_name.port_name
fragment_name.operator_name.port_name:index
- Parameters
tensor – The Tensor to log.
unique_id – A unique identifier for the message.
acquisition_timestamp – Timestamp when the data was acquired (-1 if unknown).
metadata – Associated metadata dictionary for the message.
io_type – The type of I/O port (kInput or kOutput).
- Returns
true if logging was successful, false otherwise.
Logs a TensorMap with optional data content logging.
This specialized method allows efficient logging of tensor map metadata without the overhead of logging large tensor data arrays when only header information is needed.
The unique_id for the message will have the form:
operator_name.port_name
operator_name.port_name:index (for multi-receivers with N:1 connection)
For distributed applications, the fragment name will also appear in the unique id:
fragment_name.operator_name.port_name
fragment_name.operator_name.port_name:index
- Parameters
tensor_map – The TensorMap to log.
unique_id – A unique identifier for the message.
acquisition_timestamp – Timestamp when the data was acquired (-1 if unknown).
metadata – Associated metadata dictionary for the message.
io_type – The type of I/O port (kInput or kOutput).
- Returns
true if logging was successful, false otherwise.
-
bool should_log_message(const std::string &unique_id) const
Checks if a message with the given unique_id should be logged based on allowlist/denylist patterns.
This utility function implements the filtering logic:
If allowlist patterns are specified and unique_id matches any allowlist pattern: log it
If allowlist patterns are specified and unique_id doesn’t match any allowlist pattern: don’t log it
If no allowlist patterns are specified, check denylist:
If unique_id matches any denylist pattern: don’t log it
Otherwise: log it
- Parameters
unique_id – The unique identifier to check against patterns.
- Returns
true if the message should be logged, false otherwise.
-
inline virtual bool should_log_output() const override
Checks if the logger should log output ports.
If False, the data logger will not be applied during op_input.emit() calls from Operator::compute.
- Returns
true if the logger should log output ports, false otherwise.
-
inline virtual bool should_log_input() const override
Checks if the logger should log input ports.
If False, the data logger will not be applied during op_input.receive() calls from Operator::compute.
- Returns
true if the logger should log input ports, false otherwise.
-
inline bool should_log_metadata() const
Checks if the logger should log metadata.
If False, the data logger will not log metadata for each operator.
- Returns
true if the logger should log metadata, false otherwise.
-
inline bool should_log_tensor_data_content() const
Checks if the logger should log tensor data content.
If False, only tensor header information will be logged, not the actual data arrays. When true, the full tensor data is also logged.
- Returns
true if the logger should log tensor data content, false otherwise.
-
virtual int64_t get_timestamp() const
Get the current timestamp for logging operations.
This method is called internally by the logging functions to obtain timestamps for emit_timestamp (when io_type==IOSpec::IOType::kOutput) or receive_timestamp (when io_type==IOSpec::IOType::kInput). The default implementation provides high-resolution timestamps in microseconds since epoch. Implementations can override this to provide custom timing mechanisms as appropriate.
- Returns
Current timestamp in microseconds since epoch, or -1 if not available.
-
virtual void initialize() override
Initialize the component.
This method is called only once when the component is created for the first time, and use of light-weight initialization.
Protected Attributes
-
Parameter<bool> log_outputs_
-
Parameter<bool> log_inputs_
-
Parameter<bool> log_tensor_data_content_
-
Parameter<bool> log_metadata_
-
Parameter<std::vector<std::string>> allowlist_patterns_
-
Parameter<std::vector<std::string>> denylist_patterns_
-
template<typename ArgT, typename ...ArgsT, typename = std::enable_if_t<!std::is_base_of_v<::holoscan::Resource, std::decay_t<ArgT>> && (std::is_same_v<::holoscan::Arg, std::decay_t<ArgT>> || std::is_same_v<::holoscan::ArgList, std::decay_t<ArgT>>)>>