File: macros.rs

package info (click to toggle)
rust-tracing-core 0.1.32-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 372 kB
  • sloc: makefile: 4
file content (48 lines) | stat: -rw-r--r-- 1,204 bytes parent folder | download | duplicates (47)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
use tracing_core::{
    callsite::Callsite,
    metadata,
    metadata::{Kind, Level, Metadata},
    subscriber::Interest,
};

#[test]
fn metadata_macro_api() {
    // This test should catch any inadvertent breaking changes
    // caused by changes to the macro.
    struct TestCallsite;

    impl Callsite for TestCallsite {
        fn set_interest(&self, _: Interest) {
            unimplemented!("test")
        }
        fn metadata(&self) -> &Metadata<'_> {
            unimplemented!("test")
        }
    }

    static CALLSITE: TestCallsite = TestCallsite;
    let _metadata = metadata! {
        name: "test_metadata",
        target: "test_target",
        level: Level::DEBUG,
        fields: &["foo", "bar", "baz"],
        callsite: &CALLSITE,
        kind: Kind::SPAN,
    };
    let _metadata = metadata! {
        name: "test_metadata",
        target: "test_target",
        level: Level::TRACE,
        fields: &[],
        callsite: &CALLSITE,
        kind: Kind::EVENT,
    };
    let _metadata = metadata! {
        name: "test_metadata",
        target: "test_target",
        level: Level::INFO,
        fields: &[],
        callsite: &CALLSITE,
        kind: Kind::EVENT
    };
}