[][src]Struct ll::OngoingEvent

pub struct OngoingEvent { /* fields omitted */ }

Implementations

impl OngoingEvent[src]

Public event that is passed to a logger call closure l.event("my_event", |ongoing_event| { ... });

This struct has an API that can modify the underlying Event object, which is not public.

pub fn add_data<K, V>(&self, key: K, value: V) -> &Self where
    K: Into<String>,
    V: Into<DataValue>, 
[src]

Add a piece of data associated with the event. This data will be logged together with the event.

let l = ll::Logger::new();
l.event("some_event", |e| {
    e.add_data("random_counter", 5);
    // it also supports hashtag, which can be handled by provided Drain
    // implementations during logging.
    e.add_data("dont_print_this_data #dontprint", true);
    Ok(())
}).unwrap();

pub fn set_error_msg<S: Into<String>>(&self, msg: S)[src]

Sets an error message for the event as a separate field.

let l = ll::Logger::new();
l.event("some_event", |e| {
    e.set_error_msg("It crashed!!!");
    Ok(())
}).unwrap();

pub fn discard(&self)[src]

Discard an event manually. After calling this function will not be logged.

pub fn event<E: Into<String>, F, T>(&self, event_name: E, f: F) -> Result<T> where
    F: FnOnce(OngoingEvent) -> Result<T>, 
[src]

pub async fn async_event<E: Into<String>, FN, FT, T, '_>(
    &'_ self,
    event_name: E,
    f: FN
) -> Result<T> where
    FN: FnOnce(OngoingEvent) -> FT,
    FT: Future<Output = Result<T>>, 
[src]

Trait Implementations

impl From<Arc<Mutex<Event>>> for OngoingEvent[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.