devela/sys/log/
ext.rs

1// devela::sys::log::ext
2
3use super::{LogConfig, LogLevelFilter, Logger};
4#[cfg(feature = "alloc")]
5use crate::Box;
6
7#[doc = crate::TAG_NAMESPACE!()]
8/// Extension trait providing additional methods for [`Logger`]s.
9#[cfg_attr(feature = "nightly_doc", doc(cfg(feature = "dep_log")))]
10pub trait ExtLogger: Logger {
11    /// Returns the logger as a `Logger` trait object.
12    #[must_use]
13    #[cfg(feature = "alloc")]
14    #[cfg_attr(feature = "nightly_doc", doc(cfg(feature = "alloc")))]
15    fn as_logger(self: Box<Self>) -> Box<dyn Logger>;
16
17    /// Returns a reference of the configuration.
18    #[must_use]
19    fn config(&self) -> Option<&LogConfig>;
20
21    /// Returns the level filter for this logger.
22    #[must_use]
23    fn level_filter(&self) -> LogLevelFilter;
24}