1#[doc = crate::_tags!(log)]
8#[doc = crate::_doc_meta!{
10 location("sys/log", enum DiagLevel),
11 test_size_of(DiagLevel = 1|8; niche Option),
12}]
13#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash, Ord, PartialOrd)]
14#[allow(missing_docs)]
15pub enum DiagLevel {
16 Trace,
17 Debug,
18 #[doc = crate::_tags!(init)]
19 #[default]
20 Info,
21 Warn,
22 Error,
23}
24
25#[doc = crate::_tags!(log)]
26#[doc = crate::_doc_meta!{
28 location("sys/log", trait DiagOut),
29}]
30pub trait DiagOut {
36 type Error;
38
39 fn diag(&mut self, level: DiagLevel, text: &str) -> Result<(), Self::Error>;
41
42 fn trace(&mut self, text: &str) -> Result<(), Self::Error> {
44 self.diag(DiagLevel::Trace, text)
45 }
46 fn debug(&mut self, text: &str) -> Result<(), Self::Error> {
48 self.diag(DiagLevel::Debug, text)
49 }
50 fn info(&mut self, text: &str) -> Result<(), Self::Error> {
52 self.diag(DiagLevel::Info, text)
53 }
54 fn warn(&mut self, text: &str) -> Result<(), Self::Error> {
56 self.diag(DiagLevel::Warn, text)
57 }
58 fn error(&mut self, text: &str) -> Result<(), Self::Error> {
60 self.diag(DiagLevel::Error, text)
61 }
62}