Macro tX

Source
macro_rules! tX {
    ($key:ident, $level:path) => { ... };
}
Expand description

Test if a given Level is enabled for a given LogKey

If given the $lvl is enabled for $key the function returns true, otherwise false.

It is not intended to use this Macro directly. Use the shortcut macros provided instead:

tEM, tA, tC, tE, tW, tN, tI, tD1, tD2, tD3, tD4, tD5, tD6, tD7, tD8, tD9, tD10

§Example

use hclog::{Level, FacadeVariant, options::Options};

enum TxKey { AA, }

use TxKey::AA;

fn main() {

    assert!(hclog::tX!(AA, Level::Debug9));            // Debug9 is enabled
    assert_eq!(hclog::tX!(AA, Level::Debug10), false); // Debug10 is not enabled
    // the lines below are actually shortcuts for the above lines
    assert!(hclog::tD9!(AA));
    assert_eq!(hclog::tD10!(AA), false);               // Debug10 is not enabled
}

§Panics

Panics if the given LogKey is not initialized. See add_submodules for more information.