miden_diagnostics/
config.rs

1use crate::term::Config;
2
3#[derive(Debug, Clone)]
4pub struct DiagnosticsConfig {
5    pub verbosity: Verbosity,
6    pub warnings_as_errors: bool,
7    pub no_warn: bool,
8    pub display: Config,
9}
10impl Default for DiagnosticsConfig {
11    fn default() -> Self {
12        Self {
13            verbosity: Verbosity::Info,
14            warnings_as_errors: false,
15            no_warn: false,
16            display: Config::default(),
17        }
18    }
19}
20
21#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
22pub enum Verbosity {
23    Debug,
24    Info,
25    Warning,
26    Error,
27    Silent,
28}
29impl Verbosity {
30    pub fn from_level(level: isize) -> Self {
31        if level < 0 {
32            return Verbosity::Silent;
33        }
34
35        match level {
36            0 => Verbosity::Warning,
37            1 => Verbosity::Info,
38            _ => Verbosity::Debug,
39        }
40    }
41
42    pub fn is_silent(&self) -> bool {
43        matches!(self, Self::Silent)
44    }
45}