[][src]Struct gelf::Message

pub struct Message<'a> { /* fields omitted */ }

Message is thre representation of a GELF message.

Message provides a fluid setter and getter interface to all of GELF's features. Only the host-field is not available. It is managed the Logger.

A Message can also be constructed from a log::LogRecord. All available metadata is transferred over to the message object.

Methods

impl<'a> Message<'a>[src]

pub fn new<S>(short_message: S) -> Self where
    S: Into<Cow<'a, str>> + AsRef<str>, 
[src]

Construct a new log message.

All fields will use their defaults. This means usually Option::None. A notable exception is level. The GELF spec requires this field to default to Level::Alert.

pub fn new_with_level<S>(short_message: S, level: Level) -> Self where
    S: Into<Cow<'a, str>> + AsRef<str>, 
[src]

Construct a new log message with a defined level

All fields will use their defaults. This means usually Option::None.

pub fn short_message(&self) -> &Cow<'a, str>[src]

Return the short_message

pub fn set_short_message<S>(&mut self, msg: S) -> &mut Self where
    S: Into<Cow<'a, str>> + AsRef<str>, 
[src]

Set the short_message

pub fn full_message(&self) -> &Option<Cow<'a, str>>[src]

Return the full_message

pub fn set_full_message<S>(&mut self, msg: S) -> &mut Self where
    S: Into<Cow<'a, str>> + AsRef<str>, 
[src]

Set the full_message

pub fn clear_full_message(&mut self) -> &mut Self[src]

pub fn timestamp(&self) -> &Option<DateTime<Utc>>[src]

Return the timestamp

pub fn set_timestamp(&mut self, ts: DateTime<Utc>) -> &mut Self[src]

Set the timestamp

pub fn clear_timestamp(&mut self) -> &mut Self[src]

Clear the timestamp

pub fn level(&self) -> Level[src]

Return the level

pub fn set_level(&mut self, level: Level) -> &mut Self[src]

Set the level

pub fn metadata(&self, key: &'a str) -> Option<&Cow<'a, str>>[src]

Return a metadata field with given key

pub fn all_metadata(&self) -> &HashMap<Cow<'a, str>, Cow<'a, str>>[src]

Return all metadata

pub fn set_metadata<S, T>(&mut self, key: S, value: T) -> Result<&mut Self> where
    S: Into<Cow<'a, str>> + AsRef<str>,
    T: Into<Cow<'a, str>> + AsRef<str>, 
[src]

Set a metadata field with given key to value

Trait Implementations

impl<'a> Clone for Message<'a>[src]

impl<'a> Debug for Message<'a>[src]

impl<'de, 'a> Deserialize<'de> for Message<'a>[src]

impl<'a> From<&'a Record<'a>> for Message<'a>[src]

fn from(record: &'a Record) -> Message<'a>[src]

Create a Message from given log::LogRecord including all metadata

impl<'a> PartialEq<Message<'a>> for Message<'a>[src]

impl<'a> Serialize for Message<'a>[src]

impl<'a> StructuralPartialEq for Message<'a>[src]

Auto Trait Implementations

impl<'a> RefUnwindSafe for Message<'a>

impl<'a> Send for Message<'a>

impl<'a> Sync for Message<'a>

impl<'a> Unpin for Message<'a>

impl<'a> UnwindSafe for Message<'a>

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> DeserializeOwned for T where
    T: Deserialize<'de>, 
[src]

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

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

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,