summaryrefslogtreecommitdiffstats
path: root/vendor/tracing-subscriber-0.3.3/src/layer/layered.rs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--vendor/tracing-subscriber-0.3.3/src/layer/layered.rs (renamed from vendor/tracing-subscriber/src/layer/layered.rs)57
1 files changed, 4 insertions, 53 deletions
diff --git a/vendor/tracing-subscriber/src/layer/layered.rs b/vendor/tracing-subscriber-0.3.3/src/layer/layered.rs
index 805ec13dc..c690764ad 100644
--- a/vendor/tracing-subscriber/src/layer/layered.rs
+++ b/vendor/tracing-subscriber-0.3.3/src/layer/layered.rs
@@ -12,17 +12,13 @@ use crate::{
};
#[cfg(all(feature = "registry", feature = "std"))]
use crate::{filter::FilterId, registry::Registry};
-use core::{
- any::{Any, TypeId},
- cmp, fmt,
- marker::PhantomData,
-};
+use core::{any::TypeId, cmp, fmt, marker::PhantomData};
/// A [`Subscriber`] composed of a `Subscriber` wrapped by one or more
/// [`Layer`]s.
///
/// [`Layer`]: crate::Layer
-/// [`Subscriber`]: tracing_core::Subscriber
+/// [`Subscriber`]: https://docs.rs/tracing-core/latest/tracing_core/trait.Subscriber.html
#[derive(Clone)]
pub struct Layered<L, I, S = I> {
/// The layer.
@@ -67,30 +63,6 @@ pub struct Layered<L, I, S = I> {
// === impl Layered ===
-impl<L, S> Layered<L, S>
-where
- L: Layer<S>,
- S: Subscriber,
-{
- /// Returns `true` if this [`Subscriber`] is the same type as `T`.
- pub fn is<T: Any>(&self) -> bool {
- self.downcast_ref::<T>().is_some()
- }
-
- /// Returns some reference to this [`Subscriber`] value if it is of type `T`,
- /// or `None` if it isn't.
- pub fn downcast_ref<T: Any>(&self) -> Option<&T> {
- unsafe {
- let raw = self.downcast_raw(TypeId::of::<T>())?;
- if raw.is_null() {
- None
- } else {
- Some(&*(raw as *const T))
- }
- }
- }
-}
-
impl<L, S> Subscriber for Layered<L, S>
where
L: Layer<S>,
@@ -139,16 +111,6 @@ where
self.layer.on_follows_from(span, follows, self.ctx());
}
- fn event_enabled(&self, event: &Event<'_>) -> bool {
- if self.layer.event_enabled(event, self.ctx()) {
- // if the outer layer enables the event, ask the inner subscriber.
- self.inner.event_enabled(event)
- } else {
- // otherwise, the event is disabled by this layer
- false
- }
- }
-
fn event(&self, event: &Event<'_>) {
self.inner.event(event);
self.layer.on_event(event, self.ctx());
@@ -190,7 +152,7 @@ where
#[cfg(all(feature = "registry", feature = "std"))]
{
if let Some(g) = guard.as_mut() {
- g.set_closing()
+ g.is_closing()
};
}
@@ -289,17 +251,6 @@ where
}
#[inline]
- fn event_enabled(&self, event: &Event<'_>, ctx: Context<'_, S>) -> bool {
- if self.layer.event_enabled(event, ctx.clone()) {
- // if the outer layer enables the event, ask the inner subscriber.
- self.inner.event_enabled(event, ctx)
- } else {
- // otherwise, the event is disabled by this layer
- false
- }
- }
-
- #[inline]
fn on_event(&self, event: &Event<'_>, ctx: Context<'_, S>) {
self.inner.on_event(event, ctx.clone());
self.layer.on_event(event, ctx);
@@ -435,7 +386,7 @@ where
// (rather than calling into the inner type), clear the current
// per-layer filter interest state.
#[cfg(feature = "registry")]
- filter::FilterState::take_interest();
+ drop(filter::FilterState::take_interest());
return outer;
}