Macro enso_logger::define_levels[][src]

macro_rules! define_levels {
    ($($name : ident), *) => { ... };
}
Expand description

Utility for defining verbosity levels. Each verbosity level is defined as a separate structure. Moreover, it will also define a module filter_from containing similar structures, which will be useful for compile time filtering. The meaning of filter_from::Warning is meant to be “keep every message with priority higher or equal to warning”.

For example, for the given input define_levels!(Trace,Debug,Info,Warning,Error);, the following output will be generated:

    #[derive(Clone,Copy,Debug,Default,PartialEq,Eq,Hash)]
    pub struct Trace;
    #[derive(Clone,Copy,Debug,Default,PartialEq,Eq,Hash)]
    pub struct Debug;
    #[derive(Clone,Copy,Debug,Default,PartialEq,Eq,Hash)]
    pub struct Info;
    #[derive(Clone,Copy,Debug,Default,PartialEq,Eq,Hash)]
    pub struct Warning;
    #[derive(Clone,Copy,Debug,Default,PartialEq,Eq,Hash)]
    pub struct Error;
    pub mod filter_from {
        #[derive(Clone,Copy,Debug,Default,PartialEq,Eq,Hash)]
        pub struct Trace;
        #[derive(Clone,Copy,Debug,Default,PartialEq,Eq,Hash)]
        pub struct Debug;
        #[derive(Clone,Copy,Debug,Default,PartialEq,Eq,Hash)]
        pub struct Info;
        #[derive(Clone,Copy,Debug,Default,PartialEq,Eq,Hash)]
        pub struct Warning;
        #[derive(Clone,Copy,Debug,Default,PartialEq,Eq,Hash)]
        pub struct Error;
    }