Skip to main content

bitwarden_logging/
config.rs

1//! Configuration for the Flight Recorder.
2
3use std::num::NonZeroUsize;
4
5/// Configuration for the Flight Recorder system.
6#[derive(Debug, Clone)]
7pub struct FlightRecorderConfig {
8    /// Maximum number of events to retain in the circular buffer.
9    pub buffer_size: NonZeroUsize,
10    /// Minimum tracing level to capture.
11    pub level: tracing::Level,
12}
13
14impl Default for FlightRecorderConfig {
15    fn default() -> Self {
16        Self {
17            buffer_size: NonZeroUsize::new(1000).expect("1000 is non-zero"),
18            level: tracing::Level::DEBUG,
19        }
20    }
21}
22
23impl FlightRecorderConfig {
24    /// Create a new configuration with the given buffer size and tracing level.
25    pub fn new(buffer_size: NonZeroUsize, level: tracing::Level) -> Self {
26        Self { buffer_size, level }
27    }
28}