Class BasicConsoleLogger
Defined in File basic_console_logger.hpp
Base Type
public holoscan::DataLoggerResource
(Class DataLoggerResource)
Derived Type
public holoscan::data_loggers::GXFConsoleLogger
(Class GXFConsoleLogger)
-
class BasicConsoleLogger : public holoscan::DataLoggerResource
Class for logging information to the console at runtime.
Information on message contents are logging on emit and/or receive.
==Parameters ==
serializer : std::shared_ptr<SimpleTextSerializer>
Text serialization resource (optional). A SimpleTextSerializer initialized with default parameters will be automatically added if none is provided.
log_inputs: bool (optional, default: true)
Globally enable or disable logging on input ports (
InputContext::receive
calls)
log_outputs: bool (optional, default: true)
Globally enable or disable logging on output ports (
OutputContext::emit
calls)
log_metadata: bool (optional, default: true)
Globally enable or disable logging of MetadataDictionary contents
log_tensor_data_contents: bool (optional, default: false)
Enable logging of the contents of tensors, not just basic description information. The
max_elements
parameter of theSimpleTextSerialzier
provided toserializer
can be used to control how many elements are logged.
allowlist_patterns: std::vector<std::string> (optional, default: empty vector)
denylist_patterns: std::vector<std::string> (optional, default: empty vector)
Note on allowlist/denylist pattern matching:
If
allowlist_patterns
ordenylist_patterns
are specified, they are applied to theunique_id
assigned to messages by the underlying framework.In a non-distributed application (without a fragment name), the unique_id for a message will have one of the following forms:
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 (for multi-receivers with N:1 connection)
The pattern matching logic is as follows:
If
denylist patterns
is not empty and there is a match, do not log it.Next check if
allowlist_patterns
is empty:If yes, return true (allow everything)
If no, return true only if there is a match to at least one of the specified patterns.
Subclassed by holoscan::data_loggers::GXFConsoleLogger
Public Functions
- HOLOSCAN_RESOURCE_FORWARD_ARGS_SUPER (BasicConsoleLogger, DataLoggerResource) BasicConsoleLogger()=default
-
virtual void setup(ComponentSpec &spec) override
Defines parameters for the logging resource, including the serializer.
- Parameters
spec – The component specification.
-
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.
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.
Logs backend-specific data types.
This method is called for logging backend-specific data types (intended for use with backends that have separate emit/receive codepaths for backend-specific types). The data parameter is kept as std::any here to avoid making the base interface specific to a particular backend, but a backend-specific concrete implementation should be provided as needed via run-time type checking.
A concrete example of a backend-specific type is the GXF Entity type which is a heterogeneous collection of components. An implementation of this method for GXF entities is provided in the concrete implementation of the GXFConsoleLogger.
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 backend-specific 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 was successful, false if backend-specific logging is not supported.