36 lines
1.0 KiB
Rust
36 lines
1.0 KiB
Rust
//! Persisted, restart-only runtime-observability policy.
|
|
|
|
use kaptan_config::ConfigValidate;
|
|
|
|
/// Candidate-only observability policy. It deliberately controls only optional
|
|
/// detail; error-level records are never suppressible configuration fields.
|
|
#[derive(Clone, Copy, ConfigValidate)]
|
|
pub(super) struct ObservabilityCandidate {
|
|
#[config(
|
|
id = 24,
|
|
key = "observability.maximum_log_level",
|
|
unit = "mav_severity",
|
|
default = 6,
|
|
range(min = 3, max = 7)
|
|
)]
|
|
pub(super) maximum_log_level: u32,
|
|
}
|
|
|
|
/// Immutable boot-active best-effort observability policy.
|
|
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
|
|
pub struct ObservabilitySettings {
|
|
maximum_log_level: u32,
|
|
}
|
|
|
|
impl ObservabilitySettings {
|
|
pub(crate) const fn new(maximum_log_level: u32) -> Self {
|
|
Self { maximum_log_level }
|
|
}
|
|
|
|
/// Maximum best-effort MAVLink severity: Error (3) through Debug (7).
|
|
/// This never filters error-level records.
|
|
pub const fn maximum_log_level(self) -> u32 {
|
|
self.maximum_log_level
|
|
}
|
|
}
|