Skip to main content

Crate santh_tracing

Crate santh_tracing 

Source
Expand description

Consistent tracing shape for Santh CLI tools.

§Quick start

use santh_tracing::{init, LogLevel};

let _guard = init("mytool", LogLevel::Info);
santh_tracing::tracing::info!("ready");

§Safe-defaults answers

  • Input size: log-line size tracks what the caller emits; the optional RedactingWriter buffers one line at a time, never the whole stream.
  • Recursion depth: operation spans nest only as deep as the caller’s with_op calls; the library itself adds no recursion.
  • Outbound network: none. The crate performs no network access.
  • Process spawning: none. The crate spawns no child processes.
  • Filesystem writes: none by default (logs go to stderr). A file is opened for append only when the caller explicitly sets InitConfig::file_sink, which validates the path up front.
  • Credential exposure: the default sink does not redact. Wrap a sink in RedactingWriter to mask secrets line-by-line through santh-error’s redactor before they reach the destination.

Re-exports§

pub use metrics::*;

Modules§

metrics
Metrics facade that automatically namespaces under santh_<tool_name>_.
tracing
Re-export for tool code and tests.

Macros§

santh_span
Run body inside a span with explicit tool, operation, and target fields.

Structs§

InitConfig
Declarative configuration for init_with.
InitGuard
Guard returned by init; dropping does not uninstall the global subscriber.
RedactingWriter
Wraps a writer and redacts known secret shapes from every line written through it. Redaction is line-oriented: complete lines are redacted and forwarded immediately; a trailing partial line is held until the next newline or until flush.

Enums§

Error
Errors that can occur in santh-tracing.
LogLevel
Log level configured at init time.

Functions§

init
Install the global Santh tracing subscriber for a tool process.
init_with
Install the global Santh tracing subscriber from an InitConfig.
with_op
Run body inside a nested operation span.