Skip to content

adapters

Adapters layer - Concrete implementations of ports for external integrations

This module contains WASM-compatible implementations that connect our core domain to external systems like stdout, HTTP endpoints, and standard logging frameworks.

JSON formatter for structured logging output

Compact JSON formatter (single line)

Plain text formatter for human-readable output

WASM stdout transport adapter

Methods

fn new(formatter: Box<dyn FormatterPort>) -> Self
fn with_json_formatter() -> Self
fn with_compact_formatter() -> Self
fn with_plain_text_formatter() -> Self

No-op transport for testing/disabled logging

Parsed RUST_LOG-style directives for per-target log filtering.

Supports: "info", "info,agent_sdk=debug,a2a_protocol_core=trace". Unknown tokens are silently ignored.

Methods

fn from_level(level: LogLevel) -> Self
fn parse(s: &str) -> Self

Parse a RUST_LOG-style directive string.

Examples: "info", "info,agent_sdk=debug", "warn,a2a_protocol_core=trace,llm_client=debug".

fn global_level(&self) -> LogLevel
fn max_level(&self) -> LogLevel
fn enabled(&self, level: LogLevel, target: &str) -> bool

Check whether a log record at level from target should be emitted.

Standard logging adapter that hooks into Rust’s log crate

Methods

fn new(processor_chain: ProcessorChain, transport: Arc<dyn TransportPort>, directives: LogDirectives) -> Self

Thread-local context adapter (WASM-compatible)

Methods

fn new() -> Self

Builder for creating a complete logging setup

Methods

fn new() -> Self
fn with_processor_chain(self, chain: ProcessorChain) -> Self
fn with_transport(self, transport: Arc<dyn TransportPort>) -> Self
fn with_level_filter(self, level: LogLevel) -> Self
fn with_directives(self, directives: LogDirectives) -> Self
fn build(self) -> ObservabilityResult<StandardLogAdapter>

Tracing subscriber adapter for structured logging integration

This adapter implements tracing::Subscriber to capture tracing events and convert them to LogEntry for processing through the hexagonal architecture

Methods

fn new(processor_chain: ProcessorChain, transport: Arc<dyn TransportPort>, level_filter: LogLevel) -> Self

Builder for creating tracing-integrated logging setup

Methods

fn new() -> Self
fn with_processor_chain(self, chain: ProcessorChain) -> Self
fn with_transport(self, transport: Arc<dyn TransportPort>) -> Self
fn with_level_filter(self, level: LogLevel) -> Self
fn build(self) -> ObservabilityResult<TracingSubscriberAdapter>

Basic WASM stdout adapter for metrics (correlation-focused)

Methods

fn new() -> Self
fn disabled() -> Self

Extended WASM adapter that handles both logs and metrics with correlation

Methods

fn new() -> Self
fn transport_metric(&self, entry: &MetricsEntry) -> ObservabilityResult<()>

Process metrics entry through same formatting as logs for correlation