libdd_capabilities/log_output.rs
1// Copyright 2026-Present Datadog, Inc. https://www.datadoghq.com/
2// SPDX-License-Identifier: Apache-2.0
3
4//! Log-output capability trait.
5//!
6//! Lets the trace pipeline emit already-encoded log-exporter output to the
7//! platform's log sink. On native targets this writes to process stdout; a wasm
8//! consumer implements it by handing the bytes to the host (e.g. JavaScript),
9//! since wasm cannot write to stdout directly.
10
11/// Capability for writing encoded log-exporter output to the platform log sink.
12pub trait LogWriterCapability {
13 /// Write a buffer of newline-delimited log output.
14 ///
15 /// `bytes` may contain one or more `\n`-terminated JSON lines. Implementations
16 /// should write the whole buffer (so individual lines are not interleaved with
17 /// other writers) and flush before returning.
18 fn write_log_output(&self, bytes: &[u8]) -> std::io::Result<()>;
19}