pub struct InitConfig { /* private fields */ }Expand description
Declarative configuration for init_with.
One entry point, many shapes: every tool configures tracing by chaining
builder methods rather than reaching for tracing_subscriber directly.
The default is the Santh house style - stderr, full human format, target
suppressed, RUST_LOG-or-level filtering.
Implementations§
Source§impl InitConfig
impl InitConfig
Sourcepub fn new(tool: impl Into<String>, level: LogLevel) -> Self
pub fn new(tool: impl Into<String>, level: LogLevel) -> Self
Start a configuration for tool, defaulting to level when the
environment does not specify a filter.
Sourcepub fn deny_by_default(self) -> Self
pub fn deny_by_default(self) -> Self
Emit nothing when the filter environment variable is unset, instead of
falling back to level. For tools that must stay silent unless the
operator opts in (e.g. via RUST_LOG).
Sourcepub fn json_output(self) -> Self
pub fn json_output(self) -> Self
Emit newline-delimited JSON (one object per event) instead of the
human format. Mutually exclusive with compact; the
last one set wins.
Sourcepub fn compact(self) -> Self
pub fn compact(self) -> Self
Use the compact single-line human format. Mutually exclusive with
json_output; the last one set wins.
Sourcepub fn without_time(self) -> Self
pub fn without_time(self) -> Self
Suppress the timestamp field. Useful for deterministic test output and for tools whose host (journald, the TUI) already timestamps lines.
Sourcepub fn default_filter(self, directives: impl Into<String>) -> Self
pub fn default_filter(self, directives: impl Into<String>) -> Self
Set a default filter directive string (e.g. "info,chromiumoxide=error")
used when the filter environment variable is unset. Takes precedence
over the bare level fallback.
Sourcepub fn env_var(self, name: impl Into<String>) -> Self
pub fn env_var(self, name: impl Into<String>) -> Self
Read the filter from a tool-specific environment variable name (e.g.
"WARPSCAN_LOG") instead of the default RUST_LOG.
Sourcepub fn file_sink(self, path: impl Into<PathBuf>) -> Result<Self>
pub fn file_sink(self, path: impl Into<PathBuf>) -> Result<Self>
Write logs to path (opened for append, ANSI colour off) instead of
stderr. Intended for TUI tools whose terminal is owned by the UI.
§Errors
Returns std::io::Error if path cannot be opened for append, so the
caller can fall back loudly rather than silently losing logs.
Trait Implementations§
Source§impl Clone for InitConfig
impl Clone for InitConfig
Source§fn clone(&self) -> InitConfig
fn clone(&self) -> InitConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more