mz_pgwire_common/
severity.rs
1#[derive(Clone, Copy, Debug, Eq, PartialEq)]
11pub enum Severity {
12 Panic,
13 Fatal,
14 Error,
15 Warning,
16 Notice,
17 Debug,
18 Info,
19 Log,
20}
21
22impl Severity {
23 pub fn is_error(&self) -> bool {
24 matches!(self, Severity::Panic | Severity::Fatal | Severity::Error)
25 }
26
27 pub fn is_fatal(&self) -> bool {
28 matches!(self, Severity::Fatal)
29 }
30
31 pub fn as_str(&self) -> &'static str {
32 match self {
33 Severity::Error => "ERROR",
34 Severity::Fatal => "FATAL",
35 Severity::Panic => "PANIC",
36 Severity::Warning => "WARNING",
37 Severity::Notice => "NOTICE",
38 Severity::Debug => "DEBUG",
39 Severity::Info => "INFO",
40 Severity::Log => "LOG",
41 }
42 }
43}