pub struct LogConfig {
pub level: LogLevel,
pub timestamps: bool,
pub source_location: bool,
pub correlation_ids: bool,
pub custom_fields: HashMap<String, Value>,
pub format: LogFormat,
}Expand description
Logging configuration.
§Examples
use pmcp::shared::logging::{LogConfig, LogLevel, LogFormat};
use std::collections::HashMap;
let config = LogConfig {
level: LogLevel::Info,
timestamps: true,
source_location: false,
correlation_ids: true,
custom_fields: HashMap::new(),
format: LogFormat::Json,
};
// With custom fields
let mut custom_fields = HashMap::new();
custom_fields.insert("service".to_string(), serde_json::json!("my-service"));
custom_fields.insert("version".to_string(), serde_json::json!("1.0.0"));
let config_with_fields = LogConfig {
level: LogLevel::Debug,
timestamps: true,
source_location: true,
correlation_ids: true,
custom_fields,
format: LogFormat::Pretty,
};Fields§
§level: LogLevelLog level.
timestamps: boolWhether to include timestamps.
source_location: boolWhether to include file/line info.
correlation_ids: boolWhether to include correlation IDs.
custom_fields: HashMap<String, Value>Custom fields to include in all logs.
format: LogFormatLog format.
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 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