mirror of
https://github.com/tokio-rs/tracing.git
synced 2025-10-02 15:24:47 +00:00
fix lifetime issues with event macro
This commit is contained in:
parent
e54b294de2
commit
cfabda9aa4
@ -130,14 +130,15 @@ macro_rules! span {
|
||||
macro_rules! event {
|
||||
(target: $target:expr, $lvl:expr, { $($k:ident = $val:expr),* }, $($arg:tt)+ ) => ({
|
||||
{ let field_values: &[& dyn $crate::Value] = &[ $( & $val),* ];
|
||||
$crate::Event {
|
||||
use $crate::Subscriber;
|
||||
$crate::Dispatcher::current().observe_event(&$crate::Event {
|
||||
timestamp: ::std::time::Instant::now(),
|
||||
parent: $crate::Span::current(),
|
||||
follows_from: &[],
|
||||
meta: &static_meta!(@ $target, $lvl, $($k),* ),
|
||||
field_values: &field_values[..],
|
||||
message: format_args!( $($arg)+ ),
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
@ -259,12 +260,6 @@ impl<'event, 'meta: 'event> Event<'event, 'meta> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'event, 'meta> Drop for Event<'event, 'meta> {
|
||||
fn drop(&mut self) {
|
||||
Dispatcher::current().observe_event(self);
|
||||
}
|
||||
}
|
||||
|
||||
// ===== impl Span =====
|
||||
|
||||
impl Span {
|
||||
|
Loading…
x
Reference in New Issue
Block a user