Class BasicConsoleLogger
Defined in File basic_console_logger.hpp
Base Type
public holoscan::DataLoggerResource
(Class DataLoggerResource)
-
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)
Allow only messages matching one of the provided regex patterns. The
denylist_patterns
parameter is ignored ifallowlist_patterns
is non-empty. See note below for more details.
denylist_patterns: std::vector<std::string> (optional, default: empty vector)
Reject any messages matching one of the provided regex patterns. This parameter is ignored if
allowlist_patterns
is non-empty. See note below for more details.
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)
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.