terrazzo-client 0.2.1

A simple macro to clone variables before passing them into a `move` closure or async block.
Documentation
#![cfg(not(feature = "diagnostics"))]
//! This module replaces the tracing crate with no-ops when tracing is disabled.
//!
//! This avoid building the tracing crate altogether in WASM when tracing is not needed.

mod span_macros;
mod trace_macros;

pub use crate::__diagnostics_debug as debug;
pub use crate::__diagnostics_debug_span as debug_span;
pub use crate::__diagnostics_enabled as enabled;
pub use crate::__diagnostics_error as error;
pub use crate::__diagnostics_error_span as error_span;
pub use crate::__diagnostics_info as info;
pub use crate::__diagnostics_info_span as info_span;
pub use crate::__diagnostics_trace as trace;
pub use crate::__diagnostics_trace_span as trace_span;
pub use crate::__diagnostics_warn as warn;
pub use crate::__diagnostics_warn_span as warn_span;

pub mod span {
    use std::marker::PhantomData;

    pub struct EnteredSpan(PhantomData<*mut ()>);

    #[derive(Clone)]
    pub struct Span;

    impl Span {
        pub fn enter(&self) -> EnteredSpan {
            EnteredSpan(PhantomData)
        }

        pub fn entered(&self) -> EnteredSpan {
            EnteredSpan(PhantomData)
        }

        pub fn current() -> Span {
            Span
        }
    }
}

pub trait Instrument: Sized {
    fn instrument(self, span: span::Span) -> Self {
        self
    }

    fn in_current_span(self) -> Self {
        self.instrument(span::Span::current())
    }
}

impl<T: Future + Sized> Instrument for T {}

pub enum Level {
    TRACE,
    DEBUG,
    INFO,
    WARN,
    ERROR,
}