[−][src]Struct opentracingrust::Log
Structured logging information to attach to spans.
Each log has a set of vaules idenfied by strings.
Values stored in fields can be of any type convertible to a LogValue
.
Logs also have an optional timestamp. If set, the timestamp must be between the start and the end of the span.
Examples
extern crate opentracingrust; use std::thread; use std::time::Duration; use std::time::SystemTime; use opentracingrust::Log; use opentracingrust::tracers::NoopTracer; fn main() { let (tracer, _) = NoopTracer::new(); let mut span = tracer.span("example"); let time = SystemTime::now(); thread::sleep(Duration::from_millis(50)); let log = Log::new() .log("error", false) .log("event", "some-event") .log("line", 26) .at(time); span.log(log); }
Methods
impl Log
[src]
impl Log
[src]
pub fn at(self, timestamp: SystemTime) -> Log
[src]
Sets the timestamp associated with the log.
pub fn at_or_now(&mut self)
[src]
Sets the timestamp to now if not set.
pub fn log<LV: Into<LogValue>>(self, key: &str, value: LV) -> Log
[src]
Extend the log fields with the given value.
If a value with the same key is already in the log the value is replaced.
pub fn iter(&self) -> Iter<String, LogValue>
[src]
Access an iterator over stored fields.
pub fn timestamp(&self) -> Option<&SystemTime>
[src]
Access the (optional) timestamp for the log.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Log
impl Send for Log
impl Sync for Log
impl Unpin for Log
impl UnwindSafe for Log
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,