mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-08-25 00:00:18 +02:00
trace-core: API polish (#962)
This branch makes a handful of `tokio-trace-core` API improvements, mostly around naming. In particular: * Rename `dispatcher::with` to `dispatcher::get_default` * Rename `Event::observe` to `Event::dispatch` * Make `field::ValidLen` trait private Closes #948 Closes #960 Signed-off-by: Eliza Weisman <[email protected]>
This commit is contained in:
@@ -740,7 +740,7 @@ macro_rules! event {
|
||||
};
|
||||
if is_enabled!(callsite) {
|
||||
let meta = callsite.metadata();
|
||||
Event::observe(meta, &valueset!(meta.fields(), $( $k = $val),* ));
|
||||
Event::dispatch(meta, &valueset!(meta.fields(), $( $k = $val),* ));
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -1091,7 +1091,7 @@ macro_rules! is_enabled {
|
||||
true
|
||||
} else {
|
||||
let meta = $callsite.metadata();
|
||||
$crate::dispatcher::with(|current| current.enabled(meta))
|
||||
$crate::dispatcher::get_default(|current| current.enabled(meta))
|
||||
}
|
||||
}};
|
||||
}
|
||||
|
||||
@@ -272,7 +272,7 @@ impl<'a> Span<'a> {
|
||||
|
||||
#[inline(always)]
|
||||
fn make(meta: &'a Metadata<'a>, new_span: Attributes) -> Span<'a> {
|
||||
let inner = dispatcher::with(move |dispatch| {
|
||||
let inner = dispatcher::get_default(move |dispatch| {
|
||||
let id = dispatch.new_span(&new_span);
|
||||
Some(Inner::new(id, dispatch, meta))
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user