tracing/tracing-core/tests/macros.rs
David Barsky 98ba44c22e
core: rename Subscriber to Collect (#1015)
This PR renames the following:

- `tracing_core::Subscriber` to `tracing_core::Collect`
- `tracing_subscriber::layer::Layer` to `tracing_subscriber::layer::Subscribe`

Authored-by: David Barsksy <dbarsky@amazon.com>
Co-authored-by: Eliza Weisman <eliza@buoyant.io>
2020-10-22 15:11:23 -04:00

48 lines
1.2 KiB
Rust

use tracing_core::{
callsite::Callsite,
collect::Interest,
metadata,
metadata::{Kind, Level, Metadata},
};
#[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
};
}