Class AsyncConsoleLogger
Defined in File async_console_logger.hpp
Base Type
public holoscan::AsyncDataLoggerResource
(Class AsyncDataLoggerResource)
-
class AsyncConsoleLogger : public holoscan::AsyncDataLoggerResource
Async version of BasicConsoleLogger using dual-queue architecture.
This class provides the same console logging functionality as BasicConsoleLogger but uses asynchronous processing with separate queues for metadata and data content. This reduces the impact on the main execution thread while maintaining the same output format and functionality.
==Parameters==
All parameters from AsyncDataLoggerResource plus:
serializer : std::shared_ptr<SimpleTextSerializer>
Text serialization resource (optional). A SimpleTextSerializer initialized with default parameters will be automatically added if none is provided.
Inherited parameters from DataLoggerResource:
log_inputs: bool (optional, default: true)
log_outputs: bool (optional, default: true)
log_metadata: bool (optional, default: true)
log_tensor_data_content: bool (optional, default: false)
allowlist_patterns: std::vector<std::string> (optional, default: empty)
denylist_patterns: std::vector<std::string> (optional, default: empty)
See the DataLoggerResource documentation for details on these inherited parameters.
AsyncDataLoggerResource specific parameters:
max_queue_size: size_t (optional, default: 50000)
Maximum number of entries in the data queue. When
enable_large_data_queue
is `true, The data queue handles tensor headers without full tensor content. Otherwise tensor data content will also be in this queue. In both cases, whether tensor data content is logged at all is controlled bylog_tensor_data_content
. Default is 50000.
worker_sleep_time: nanoseconds (optional, default: 50000ns = 50μs)
Sleep duration in nanoseconds when the data queue is empty. Lower values reduce latency but increase CPU usage. Default is 50000 (50μs).
queue_policy: AsyncQueuePolicy (optional, default: AsyncQueuePolicy::kReject)
The
queue_policy
parameter controls how queue overflow is handled. Can beAsyncQueuePolicy::kReject
(default) to reject new items with a warning, orkRaise
to throw an exception. In the YAML configuration for this parameter, you can use string values “reject” or “raise” (case-insensitive).
large_data_max_queue_size: size_t (optional, default: 1000)
Maximum number of entries in the large data queue. Default is 1000.
large_data_worker_sleep_time: nanoseconds (optional, default: 50000ns = 50μs)
Sleep duration in nanoseconds when the large data queue is empty. Lower values reduce latency but increase CPU usage. Default is 50000 (50μs).
large_data_queue_policy: bool (optional, default: AsyncQueuePolicy::kReject)
The
large_data_queue_policy
parameter controls how queue overflow is handled for the large data queue. Can beAsyncQueuePolicy::kReject
(default) to reject new items with a warning, orkRaise
to throw an exception. In the YAML configuration for this parameter, you can use string values “reject” or “raise” (case-insensitive).
enable_large_data_queue: bool (optional, default: true);
Whether to enable the large data queue and worker thread for processing full tensor content. Default is True.*
Public Functions
- HOLOSCAN_RESOURCE_FORWARD_ARGS_SUPER (AsyncConsoleLogger, AsyncDataLoggerResource) AsyncConsoleLogger()=default
-
virtual void setup(ComponentSpec &spec) override
Define the resource specification.
- Parameters
spec – The reference to 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 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.