//! Extra logging types for log files and such use super::*; use generational_arena::Index; use mopa::*; use std::marker::{Sync, Send}; /// A logging hook pub trait Hook: Sync + Send + Any { /// The name of this hook object fn name(&self) -> &str {"(unnamed)"} /// Fired when hook is added fn initialise(&mut self, _idx: &Index) {} /// Fired when `println` is called fn println(&mut self, level: &dyn AsLevel, what: &dyn Display, trace: &Trace) -> io::Result<()>; /// Fired when hook is removed fn finalise(&mut self, _idx: Index) {} } mopafy!(Hook); impl std::fmt::Debug for dyn Hook { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!(f, "") } }