mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-09-03 00:00:05 +02:00
trace: Add arguments struct to subscriber::Record (#955)
This branch changes the `Subscriber::record` method to take a new arguments struct, `span::Record`. The `field::Record` trait was renamed to `field::Visit` to prevent name conflicts. In addition, the `ValueSet::is_empty`, `ValueSet::contains`, and `ValueSet::record` methods were made crate-private, as they are exposed on the `Attributes` and `Record` types. Signed-off-by: Eliza Weisman <[email protected]>
This commit is contained in:
@@ -135,7 +135,7 @@
|
||||
//! the data for future use, record it in some manner, or discard it completely.
|
||||
//!
|
||||
//! [`Subscriber`]: ::Subscriber
|
||||
pub use tokio_trace_core::span::{Attributes, Id};
|
||||
pub use tokio_trace_core::span::{Attributes, Id, Record};
|
||||
|
||||
use std::{
|
||||
borrow::Borrow,
|
||||
@@ -324,7 +324,7 @@ impl<'a> Span<'a> {
|
||||
.is_some()
|
||||
}
|
||||
|
||||
/// Records that the field described by `field` has the value `value`.
|
||||
/// Visits that the field described by `field` has the value `value`.
|
||||
pub fn record<Q: ?Sized, V>(&mut self, field: &Q, value: &V) -> &mut Self
|
||||
where
|
||||
Q: field::AsField,
|
||||
@@ -343,7 +343,7 @@ impl<'a> Span<'a> {
|
||||
self
|
||||
}
|
||||
|
||||
/// Record all the fields in the span
|
||||
/// Visit all the fields in the span
|
||||
pub fn record_all(&mut self, values: &field::ValueSet) -> &mut Self {
|
||||
if let Some(ref mut inner) = self.inner {
|
||||
inner.record(&values);
|
||||
@@ -479,7 +479,7 @@ impl<'a> Inner<'a> {
|
||||
|
||||
fn record(&mut self, values: &field::ValueSet) {
|
||||
if values.callsite() == self.meta.callsite() {
|
||||
self.subscriber.record(&self.id, &values)
|
||||
self.subscriber.record(&self.id, &Record::new(values))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user