extern crate alloc;
use alloc::boxed::Box;
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
#[repr(u8)]
pub enum LogLevel {
Emergency = 0,
Alert = 1,
Critical = 2,
Error = 3,
Warning = 4,
Notice = 5,
Informational = 6,
Debug = 7,
}
pub trait LoggingPlugin: Send + Sync {
fn log(&self, level: LogLevel, participant: [u8; 16], category: &str, message: &str);
fn plugin_class_id(&self) -> &str;
}
pub type LoggingPluginBox = Box<dyn LoggingPlugin>;
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn log_levels_order_correctly() {
assert!(LogLevel::Emergency < LogLevel::Warning);
assert!(LogLevel::Debug > LogLevel::Error);
}
}