pub struct LoggingConfig {
pub level: Level,
pub term_level: Level,
pub json_format: bool,
pub trace_correlation: bool,
pub env_filter: Option<String>,
}Expand description
Configuration for Term’s logging setup.
Fields§
§level: LevelLog level for the application
term_level: LevelLog level for Term components specifically
json_format: boolWhether to use JSON output format
trace_correlation: boolWhether to include trace correlation (requires telemetry feature)
env_filter: Option<String>Environment filter override
Implementations§
Source§impl LoggingConfig
impl LoggingConfig
Sourcepub fn production() -> Self
pub fn production() -> Self
Creates a configuration for production use.
Sourcepub fn development() -> Self
pub fn development() -> Self
Creates a configuration for development use.
Sourcepub fn structured() -> Self
pub fn structured() -> Self
Creates a configuration for structured logging with trace correlation.
Sourcepub fn with_level(self, level: Level) -> Self
pub fn with_level(self, level: Level) -> Self
Sets the log level for the application.
Sourcepub fn with_term_level(self, level: Level) -> Self
pub fn with_term_level(self, level: Level) -> Self
Sets the log level for Term components.
Sourcepub fn with_json_format(self, enabled: bool) -> Self
pub fn with_json_format(self, enabled: bool) -> Self
Sets whether to use JSON output format.
Sourcepub fn with_trace_correlation(self, enabled: bool) -> Self
pub fn with_trace_correlation(self, enabled: bool) -> Self
Sets whether to include trace correlation.
Sourcepub fn with_env_filter(self, filter: impl Into<String>) -> Self
pub fn with_env_filter(self, filter: impl Into<String>) -> Self
Sets a custom environment filter.
Sourcepub fn env_filter(&self) -> String
pub fn env_filter(&self) -> String
Builds the environment filter string.
Trait Implementations§
Source§impl Clone for LoggingConfig
impl Clone for LoggingConfig
Source§fn clone(&self) -> LoggingConfig
fn clone(&self) -> LoggingConfig
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for LoggingConfig
impl Debug for LoggingConfig
Auto Trait Implementations§
impl Freeze for LoggingConfig
impl RefUnwindSafe for LoggingConfig
impl Send for LoggingConfig
impl Sync for LoggingConfig
impl Unpin for LoggingConfig
impl UnwindSafe for LoggingConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more