pub struct LogConfig {
pub level: LogLevel,
pub format: LogFormat,
pub target: LogTarget,
pub include_location: bool,
pub include_target: bool,
pub include_span_events: bool,
pub include_thread_ids: bool,
pub include_thread_names: bool,
pub filter: Option<String>,
pub ansi_colors: bool,
pub dynamic_level: bool,
pub module_levels: HashMap<String, LogLevel>,
}Expand description
Logging configuration.
Fields§
§level: LogLevelLog level.
format: LogFormatOutput format.
target: LogTargetOutput target.
include_location: boolInclude file and line numbers.
include_target: boolInclude target (module path).
include_span_events: boolInclude span events (enter/exit).
include_thread_ids: boolInclude thread IDs.
include_thread_names: boolInclude thread names.
filter: Option<String>Custom filter directives (e.g., “trap_sim=debug,tokio=warn”).
ansi_colors: boolEnable ANSI colors (only for Pretty/Compact formats on console).
dynamic_level: boolEnable dynamic log level changes at runtime.
module_levels: HashMap<String, LogLevel>Per-module log levels.
Implementations§
Source§impl LogConfig
impl LogConfig
Sourcepub fn builder() -> LogConfigBuilder
pub fn builder() -> LogConfigBuilder
Create a new builder.
Sourcepub fn development() -> LogConfig
pub fn development() -> LogConfig
Create a development configuration (pretty, debug level).
Sourcepub fn production() -> LogConfig
pub fn production() -> LogConfig
Create a production configuration (JSON, info level).
Sourcepub fn production_file(log_dir: impl Into<PathBuf>) -> LogConfig
pub fn production_file(log_dir: impl Into<PathBuf>) -> LogConfig
Create a production file logging configuration.
Sourcepub fn dual_output(log_dir: impl Into<PathBuf>) -> LogConfig
pub fn dual_output(log_dir: impl Into<PathBuf>) -> LogConfig
Create a dual output configuration (console + file).
Sourcepub fn build_filter_string(&self) -> String
pub fn build_filter_string(&self) -> String
Build the filter string from configuration.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for LogConfig
impl<'de> Deserialize<'de> for LogConfig
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<LogConfig, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<LogConfig, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Serialize for LogConfig
impl Serialize for LogConfig
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
Auto Trait Implementations§
impl Freeze for LogConfig
impl RefUnwindSafe for LogConfig
impl Send for LogConfig
impl Sync for LogConfig
impl Unpin for LogConfig
impl UnsafeUnpin for LogConfig
impl UnwindSafe for LogConfig
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