Skip to main content

zerodds_security_logging/
lib.rs

1// SPDX-License-Identifier: Apache-2.0
2// Copyright 2026 ZeroDDS Contributors
3
4//! Crate `zerodds-security-logging`. Safety classification: **SAFE** (reiner I/O-Wrapper; keine Secrets werden gepuffert ausserhalb der Log-Zeile selbst).
5//!
6//! Produktions-taugliche Logging-Backends fuer DDS-Security 1.1/1.2 §8.6
7//! (`LoggingPlugin`-SPI aus `zerodds-security`).
8//!
9//! ## Schichten-Position
10//!
11//! Layer 4 — Core Services. Konsumiert von end-user-Builds + DCPS-Runtime
12//! (Feature `security`).
13//!
14//! ## Public API (Stand 1.0.0-rc.1)
15//!
16//! - [`StderrLoggingPlugin`] — structured log lines an `stderr`.
17//! - [`JsonLinesLoggingPlugin`] — `application/x-ndjson` in eine Datei.
18//! - [`SyslogLoggingPlugin`] — RFC-5424-UDP-Backend (Facility `LOCAL0`).
19//! - [`FanOutLoggingPlugin`] — fan-out an mehrere Backends.
20//!
21//! # Was dieser Crate liefert
22//!
23//! 1. [`StderrLoggingPlugin`] — schreibt structured log lines an
24//!    `stderr`. Default fuer Development + Container-Deployments mit
25//!    stdout/stderr-Collector (Loki, Vector, Fluentd).
26//! 2. [`JsonLinesLoggingPlugin`] — schreibt JSON-Lines
27//!    (`application/x-ndjson`) in eine Datei. Jede Zeile = ein Event.
28//!    Ein zweiter Prozess (z.B. auditd, filebeat) rotiert die Datei.
29//! 3. [`FanOutLoggingPlugin`] — routet jedes Event an **mehrere**
30//!    Backends (z.B. stderr + JSON-File gleichzeitig).
31//!
32//! Alle Backends filtern Events nach `LogLevel`; das Default-Level ist
33//! `Warning` — niedriger (Informational, Debug) wird still verworfen.
34//!
35//! ## Nicht-Ziele
36//!
37//! - Syslog-TCP (RFC 5425) und Syslog-TLS — die meisten Syslog-
38//!   Deployments laufen im vertrauten Segment; Re-Add bei Bedarf.
39//! - Structured Telemetry (OpenTelemetry / OTLP) — abgedeckt von
40//!   `zerodds-observability-otlp` (Layer 4.6).
41//! - Log-Rotation im Plugin selbst — Aufgabe des Betriebssystems /
42//!   `logrotate`.
43
44#![cfg_attr(not(feature = "std"), no_std)]
45#![forbid(unsafe_code)]
46#![warn(missing_docs)]
47// Drei Plugin-Impls fuer Box-Polymorphie — SPI-bedingt.
48// zerodds-lint: allow no_dyn_in_safe
49
50extern crate alloc;
51
52mod fanout;
53mod jsonl;
54mod stderr_sink;
55mod syslog;
56
57pub use fanout::FanOutLoggingPlugin;
58pub use jsonl::JsonLinesLoggingPlugin;
59pub use stderr_sink::StderrLoggingPlugin;
60pub use syslog::SyslogLoggingPlugin;