Skip to main content

elfo_core/dumping/
config.rs

1//! [Config].
2//!
3//! [Config]: DumpingConfig
4
5use serde::Deserialize;
6
7/// Dumping configuration.
8///
9/// # Example
10/// ```toml
11/// [some_group]
12/// system.dumping.disabled = false
13/// system.dumping.max_rate = 1_000
14/// ```
15#[derive(Debug, Clone, Deserialize)]
16#[serde(default)]
17pub struct DumpingConfig {
18    /// Whether dumping is disabled.
19    ///
20    /// `false` by default.
21    pub disabled: bool,
22    /// Maximum rate of dumping.
23    /// Exceeding this rate will cause messages to not be dumped.
24    ///
25    /// `100_000` by default.
26    pub max_rate: u64,
27    // TODO: per class overrides.
28}
29
30impl Default for DumpingConfig {
31    fn default() -> Self {
32        Self {
33            disabled: false,
34            max_rate: 100_000,
35        }
36    }
37}