config/log_configuration.rs
1//! Contains the configuration structures for logging.
2
3use serialization::{Deserialize, Serialize};
4
5/// A configuration block to control how the application should handle logging.
6///
7/// It allows configuring the filter (which parts log at which level) and the minimum level of the logging system.
8#[derive(Debug, Serialize, Deserialize)]
9pub struct LogConfiguration {
10 /// A filter that indicates how to filter logging from various parts of the software.
11 ///
12 /// For syntax and information, see [`EnvFilter`](https://docs.rs/tracing-subscriber/latest/tracing_subscriber/filter/struct.EnvFilter.html)
13 pub filter: String,
14 /// The minimum log level for logs to be emitted.
15 ///
16 /// The following values are valid:
17 /// - `trace`
18 /// - `debug`
19 /// - `info`
20 /// - `warn`
21 /// - `error`
22 ///
23 /// Invalid or missing values will fall back to `info`.
24 /// The `level` values are case-insensitive.
25 pub level: String,
26}
27
28impl Default for LogConfiguration {
29 fn default() -> Self {
30 Self {
31 filter: String::from("io=trace"),
32 level: String::from("info"),
33 }
34 }
35}