pub struct TracingConfig {
pub format: TracingFormat,
pub span_events: bool,
pub file_info: bool,
pub thread_ids: bool,
pub thread_names: bool,
pub target: bool,
pub default_filter: String,
pub log_file: Option<PathBuf>,
pub log_to_stdout: bool,
}Expand description
Configuration for tracing initialization.
Fields§
§format: TracingFormatOutput format for logs.
span_events: boolWhether to log span enter/exit events.
file_info: boolWhether to include file name and line numbers in output.
thread_ids: boolWhether to include thread IDs in output.
thread_names: boolWhether to include thread names in output.
target: boolWhether to include target (module path) in output.
default_filter: StringDefault filter directive if RUST_LOG is not set.
log_file: Option<PathBuf>Optional log file path. If set, logs are written to this file.
log_to_stdout: boolWhether to also log to stdout when file logging is enabled.
Implementations§
Source§impl TracingConfig
impl TracingConfig
Sourcepub fn with_format(self, format: TracingFormat) -> Self
pub fn with_format(self, format: TracingFormat) -> Self
Set the output format.
Sourcepub fn with_span_events(self, enabled: bool) -> Self
pub fn with_span_events(self, enabled: bool) -> Self
Enable or disable span enter/exit events.
Sourcepub fn with_file_info(self, enabled: bool) -> Self
pub fn with_file_info(self, enabled: bool) -> Self
Enable or disable file name and line number output.
Sourcepub fn with_thread_ids(self, enabled: bool) -> Self
pub fn with_thread_ids(self, enabled: bool) -> Self
Enable or disable thread ID output.
Sourcepub fn with_thread_names(self, enabled: bool) -> Self
pub fn with_thread_names(self, enabled: bool) -> Self
Enable or disable thread name output.
Sourcepub fn with_target(self, enabled: bool) -> Self
pub fn with_target(self, enabled: bool) -> Self
Enable or disable target (module path) output.
Sourcepub fn with_default_filter(self, filter: impl Into<String>) -> Self
pub fn with_default_filter(self, filter: impl Into<String>) -> Self
Set the default filter directive (used if RUST_LOG is not set).
Sourcepub fn with_log_file(self, path: impl Into<PathBuf>) -> Self
pub fn with_log_file(self, path: impl Into<PathBuf>) -> Self
Set log file path (enables file logging).
Sourcepub fn with_stdout(self, enabled: bool) -> Self
pub fn with_stdout(self, enabled: bool) -> Self
Control whether to also log to stdout when file logging is enabled.
Sourcepub fn production() -> Self
pub fn production() -> Self
Create a configuration optimized for production/JSON logging.
Trait Implementations§
Source§impl Clone for TracingConfig
impl Clone for TracingConfig
Source§fn clone(&self) -> TracingConfig
fn clone(&self) -> TracingConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for TracingConfig
impl Debug for TracingConfig
Auto Trait Implementations§
impl Freeze for TracingConfig
impl RefUnwindSafe for TracingConfig
impl Send for TracingConfig
impl Sync for TracingConfig
impl Unpin for TracingConfig
impl UnsafeUnpin for TracingConfig
impl UnwindSafe for TracingConfig
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
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>
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>
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