Skip to main content

obs_kit/
lib.rs

1#![forbid(unsafe_code)]
2#![warn(rust_2024_compatibility, missing_docs, missing_debug_implementations)]
3#![cfg_attr(
4    test,
5    allow(
6        clippy::unwrap_used,
7        clippy::expect_used,
8        clippy::panic,
9        clippy::indexing_slicing
10    )
11)]
12
13//! Façade crate — re-exports the everyday obs API.
14//!
15//! Most downstream apps depend only on `obs-kit`. Spec 61 § 2.11 +
16//! boundary-review § 3.6 (`init_for_service`).
17
18mod init;
19
20pub use init::{InitBuilder, InitError, InitGuard, ServicePreset, init_for_service};
21/// Typed wrappers for `Classification::Secret` fields. Decision D6-2:
22/// SECRET-classified event fields should be declared as
23/// `secrecy::SecretString` / `secrecy::SecretBox<T>` so the in-memory
24/// value is also redacted at `Debug` time. The runtime scrubber (spec
25/// 14 § 5) then redacts the encoded bytes before any sink sees them.
26pub use obs_core::__private::secrecy;
27#[cfg(feature = "dev")]
28pub use obs_core::sink::FormatterStyle;
29pub use obs_core::{
30    BuildableTo, Cardinality, Classification, ENVELOPE_FORMAT_VER, Emit, EnumCount, EventSchema,
31    EventsConfig, FanOutSink, FieldCapture, FieldKind, FieldMeta, FieldRole, Filter,
32    InMemoryHandle, InMemoryObserver, InMemorySink, Instrument, Instrumented, LevelSplitWriter,
33    MakeWriter, MetricEmitter, MetricKind, NdjsonFileSink, NonBlockingWriter, NoopObserver,
34    NoopSink, ObsBatch, ObsCallsite, ObsEnvelope, ObsTraceCtx, Observer, RollingFileWriter,
35    RollingFileWriterBuilder, RollingPolicy, SamplingConfig, SamplingReason, ScopeField,
36    ScopeFrame, ScopeFrameBuilder, ScopeGuard, ScopeKind, Severity, Sink, SpanCtx, SpanFrame,
37    SpanTrace, StandardObserver, StandardObserverBuilder, StderrWriter, StdoutSink, StdoutWriter,
38    TeeWriter, Tier, W3cPropagator, WithObserver, WorkerCounters, WorkerGuard, extract_w3c,
39    fresh_span_id, fresh_trace_id, inject_w3c, install_observer, install_panic_hook, observer,
40    observer_weak, status_class, with_observer_task, with_observer_task_sync,
41    with_observer_thread_local, with_test_observer,
42};
43/// In-process live-tail subscriber registry + Sink. Enable via the
44/// `live-tail` feature. Boundary-review § 3.1.
45#[cfg(feature = "live-tail")]
46pub use obs_live_tail as live_tail;
47pub use obs_macros::{Event, context, emit, forensic, include_schemas, instrument, scope};
48/// Prometheus scrape exporter. Enable via the `prom` feature.
49/// Phase 2 boundary-review § 3.2.
50#[cfg(feature = "prom")]
51pub use obs_prom as prom;
52pub use obs_proto::obs::v1::{ObsFnEntered, ObsFnExecuted, ObsForensicEvent};
53/// Generic batching sink framework (triggers + retry + spool +
54/// escalation with a pluggable `BatchBackend` trait). Enable via the
55/// `batch-sink` feature. Phase 2 boundary-review § 3.1.
56#[cfg(feature = "batch-sink")]
57pub use obs_sink_batch as sink_batch;
58
59/// Test ergonomics — `assert_emitted!`, `#[obs::test]`. Spec 60 § 8.
60#[cfg(feature = "test")]
61pub mod test {
62    pub use obs_core::test::*;
63    pub use obs_macros::test;
64}
65
66/// Re-exports for code generated by `#[derive(Event)]` and `obs-build`.
67/// Users do not depend on these directly.
68#[doc(hidden)]
69pub use obs_core::__private;
70/// Severity ident shortcuts for use with `obs::emit!`. The macro form
71/// accepts either `Severity::Warn` or the bare `WARN` ident.
72pub use obs_core::Severity::{
73    Debug as DEBUG, Error as ERROR, Fatal as FATAL, Info as INFO, Trace as TRACE, Warn as WARN,
74};