// option. This file may not be copied, modified, or distributed
// except according to those terms.
-/// There is currently 2 ways to filter log messages. First one, by using compilation flag, e.g "max_level_off".
-/// The second one, client-side by implementing check against Record Level field, e.g TestLogger in test_utils.
-/// Each module may have its own Logger or share one.
+//! Log traits live here, which are called throughout the library to provide useful information for
+//! debugging purposes.
+//!
+//! There is currently 2 ways to filter log messages. First one, by using compilation features, e.g "max_level_off".
+//! The second one, client-side by implementing check against Record Level field.
+//! Each module may have its own Logger or share one.
use std::cmp;
use std::fmt;
+use std::sync::Arc;
static LOG_LEVEL_NAMES: [&'static str; 6] = ["OFF", "ERROR", "WARN", "INFO", "DEBUG", "TRACE"];
/// An enum representing the available verbosity levels of the logger.
-#[derive(Copy, Clone, Eq, Debug, Hash)]
+#[derive(Copy, Clone, PartialEq, Eq, Debug, Hash)]
pub enum Level {
///Designates logger being silent
Off,
Trace,
}
-impl PartialEq for Level {
- #[inline]
- fn eq(&self, other: &Level) -> bool {
- *self as usize == *other as usize
- }
-}
-
impl PartialOrd for Level {
#[inline]
fn partial_cmp(&self, other: &Level) -> Option<cmp::Ordering> {
fn log(&self, record: &Record);
}
+pub(crate) struct LogHolder<'a> { pub(crate) logger: &'a Arc<Logger> }
+
#[cfg(test)]
mod tests {
- use util::logger::{Logger, Level, Record};
+ use util::logger::{Logger, Level};
use util::test_utils::TestLogger;
use std::sync::{Arc};