Logging and diagnostics output

Updated Oct 17, 2026

Legacy parser warnings use the log API. Initialize a logger in the host binary and use RUST_LOG to control verbosity (for example RUST_LOG=warn). For structured parser-attempt and diagnostic events, pass a ParseObserver to parse_with_observer; this is opt-in and does not require a telemetry runtime. Applications can implement and pass their own ParseObserver without enabling observability; that feature is needed only for the supplied TelemetryObserver adapter. The optional observability Cargo feature supplies a tracing and metrics adapter. See the parser observability guide for export and alerting guidance. The library never initializes host subscribers or recorders.

Enable the supplied adapter in the application dependency:

[dependencies]
ddlint = { version = "0.1.0", features = ["observability"] }

Initialize the application's tracing subscriber and metrics recorder, then construct one TelemetryObserver and reuse it for parser calls:

use ddlint::{TelemetryObserver, parse_with_observer};

fn parse_sources(sources: &[&str]) {
    // Configure application telemetry before constructing the observer.
    let observer = TelemetryObserver::new();
    for source in sources {
        let _parsed = parse_with_observer(source, &observer);
    }
}