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() -> Self
pub fn development() -> Self
Create a development configuration (pretty, debug level).
Sourcepub fn production() -> Self
pub fn production() -> Self
Create a production configuration (JSON, info level).
Sourcepub fn production_file(log_dir: impl Into<PathBuf>) -> Self
pub fn production_file(log_dir: impl Into<PathBuf>) -> Self
Create a production file logging configuration.
Sourcepub fn dual_output(log_dir: impl Into<PathBuf>) -> Self
pub fn dual_output(log_dir: impl Into<PathBuf>) -> Self
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<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. 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