pub struct InitOptions { /* private fields */ }Expand description
Configuration for init_with.
Constructed via InitOptions::default and the with_* builder methods.
Each method consumes self and returns Self to support chaining:
use kamu_logging::{init_with, Format, InitOptions, Sink};
init_with(
InitOptions::default()
.with_service_name("my-service")
.with_format(Format::Json)
.with_sink(Sink::Stdout),
)?;Implementations§
Source§impl InitOptions
impl InitOptions
Sourcepub fn with_service_name(self, name: impl Into<String>) -> Self
pub fn with_service_name(self, name: impl Into<String>) -> Self
Attach a service.name field to every event. Used by log aggregators
to route logs across services.
Sourcepub fn with_default_filter(self, filter: impl Into<String>) -> Self
pub fn with_default_filter(self, filter: impl Into<String>) -> Self
Default filter directive when the env var is unset. Defaults to
"debug" in debug builds and "info" in release builds.
Sourcepub fn with_env_var(self, var: impl Into<String>) -> Self
pub fn with_env_var(self, var: impl Into<String>) -> Self
Environment variable read for the filter directive. Defaults to
"RUST_LOG". Useful for per-binary triggers like "KKP_LOG" to avoid
collisions with other tools’ RUST_LOG settings.
Sourcepub fn with_format(self, format: Format) -> Self
pub fn with_format(self, format: Format) -> Self
Output format. See Format.
Sourcepub fn idempotent(self, enabled: bool) -> Self
pub fn idempotent(self, enabled: bool) -> Self
When true, a second init_with call returns
Ok(()) instead of Error::TracingGlobal.
Default is false so library double-init surfaces as an error. Set
true from test harnesses and embedded CLI runs where re-init is
expected.
Trait Implementations§
Source§impl Clone for InitOptions
impl Clone for InitOptions
Source§fn clone(&self) -> InitOptions
fn clone(&self) -> InitOptions
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more