Skip to main content

velora_core/config/
logging.rs

1//! Logging configuration for the Velora platform.
2//!
3//! This module defines logging levels and output destinations.
4
5use serde::{Deserialize, Serialize};
6
7/// Logging configuration.
8///
9/// Controls log verbosity and output destinations.
10///
11/// # Log Levels
12///
13/// From most to least verbose:
14/// - `trace` - Very detailed debug information
15/// - `debug` - Debug information useful for development
16/// - `info` - General informational messages (default)
17/// - `warn` - Warning messages for potentially problematic situations
18/// - `error` - Error messages for failures
19///
20/// # Example
21///
22/// ```toml
23/// [logging]
24/// level = "info"
25/// file = "logs/velora.log"
26/// ```
27#[derive(Debug, Clone, Serialize, Deserialize)]
28pub struct LoggingConfig {
29    /// Log level (trace, debug, info, warn, error)
30    /// Env: VELORA_LOGGING_LEVEL
31    pub level: String,
32
33    /// Optional log file path
34    /// Env: VELORA_LOGGING_FILE
35    ///
36    /// If not specified, logs are written to stdout only.
37    #[serde(skip_serializing_if = "Option::is_none")]
38    pub file: Option<String>,
39}
40
41impl Default for LoggingConfig {
42    fn default() -> Self {
43        LoggingConfig {
44            level: "info".to_string(),
45            file: None,
46        }
47    }
48}