Context, scope, and building blocks¶
arc42 §3 (context and scope) and §4 (building blocks) for the logging stack (Shared logging base library (FEAT_0070)). The two architecture directives below frame the runtime data flow and the control plane; the building blocks then name the crates and components that realise them.
Structural overview¶
The logging stack is two crates layered behind one facade: callers emit
through taktora-log (taktora-log facade crate (BB_0090)); the default backend
taktora-log-dlt (taktora-log-dlt DLT-backend... (BB_0091)) encodes and ships DLT to a
co-located daemon via its own daemon client (DLT daemon client (within t... (BB_0092)).
graph TD
Caller["any taktora crate<br/>log::* / taktora_log::*"]
Facade["taktora-log (facade)<br/>BB_0090 — LogSink trait,<br/>init builder, tracing bridge,<br/>console fallback"]
Backend["taktora-log-dlt (backend)<br/>BB_0091 — dlt-core encoder,<br/>queue + flusher, offline ring,<br/>level table"]
Client["DLT daemon client<br/>BB_0092 — UDS/TCP, reconnect"]
Daemon["dlt-daemon<br/>(integrator-provided)"]
Other["alternative log::Log<br/>(log4rs / env_logger / bespoke)"]
Caller --> Facade
Facade -->|"default LogSink"| Backend
Facade -. "swap path (FEAT_0073)" .-> Other
Backend --> Client
Client --> Daemon
3. Context and scope¶
Caller code emits via
graph TB
Caller["caller code<br/>log::info!(...)"]
Macro["log crate facade<br/>(global log::Log)"]
Sink["active LogSink<br/>(default: taktora-log-dlt)"]
Queue["bounded SPSC/SPMC queue<br/>(no alloc, no I/O)"]
Flusher["background flusher<br/>(single task)"]
Encoder["dlt-core encoder<br/>(AUTOSAR R20-11)"]
Client["daemon client<br/>UDS or TCP"]
Daemon["dlt-daemon<br/>(integrator-provided)"]
Ring["offline ring buffer<br/>(bounded, drop-oldest)"]
Caller --> Macro
Macro --> Sink
Sink --> Queue
Queue --> Flusher
Flusher --> Encoder
Encoder --> Client
Client --> Daemon
Flusher -. on daemon down .-> Ring
Ring -. on reconnect .-> Client
|
The
graph LR
Tool["dlt-control /<br/>DLT Viewer"]
Daemon["dlt-daemon"]
ClientRx["daemon client<br/>(rx half)"]
Table["per-context level table<br/>(AtomicU8 per CtxID)"]
Enabled["log::Log::enabled<br/>short-circuit"]
Tool -- "Set-Log-Level<br/>(AppID, CtxID, level)" --> Daemon
Daemon -- "injection" --> ClientRx
ClientRx --> Table
Table --> Enabled
|
4. Building blocks¶
The facade crate. Carries the |
The DLT backend. Implements both |
The component inside taktora-log-dlt DLT-backend... (BB_0091) that owns the socket
lifecycle. Single connection, UDS by default, TCP opt-in.
Reconnect is bounded exponential backoff. The transmit half
drains the producer queue (or the offline ring during catch-up)
and writes encoded DLT bytes; the receive half decodes inbound
control messages and updates the level table. The daemon client
is module-public so a downstream crate may reuse it without the
|