pub struct Message<'a> { /* private fields */ }
Expand description
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.
Implementations§
Source§impl<'a> Message<'a>
impl<'a> Message<'a>
Sourcepub fn new<S>(short_message: S) -> Self
pub fn new<S>(short_message: S) -> Self
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.
Sourcepub fn new_with_level<S>(short_message: S, level: Level) -> Self
pub fn new_with_level<S>(short_message: S, level: Level) -> Self
Construct a new log message with a defined level
All fields will use their defaults. This means usually Option::None.
Sourcepub fn short_message(&self) -> &Cow<'a, str>
pub fn short_message(&self) -> &Cow<'a, str>
Return the short_message
Sourcepub fn set_short_message<S>(&mut self, msg: S) -> &mut Self
pub fn set_short_message<S>(&mut self, msg: S) -> &mut Self
Set the short_message
Sourcepub fn full_message(&self) -> &Option<Cow<'a, str>>
pub fn full_message(&self) -> &Option<Cow<'a, str>>
Return the full_message
Sourcepub fn set_full_message<S>(&mut self, msg: S) -> &mut Self
pub fn set_full_message<S>(&mut self, msg: S) -> &mut Self
Set the full_message
pub fn clear_full_message(&mut self) -> &mut Self
Sourcepub fn set_timestamp(&mut self, ts: DateTime<Utc>) -> &mut Self
pub fn set_timestamp(&mut self, ts: DateTime<Utc>) -> &mut Self
Set the timestamp
Sourcepub fn clear_timestamp(&mut self) -> &mut Self
pub fn clear_timestamp(&mut self) -> &mut Self
Clear the timestamp
Trait Implementations§
Source§impl<'de, 'a> Deserialize<'de> for Message<'a>
impl<'de, 'a> Deserialize<'de> for Message<'a>
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl<'a> StructuralPartialEq for Message<'a>
Auto Trait Implementations§
impl<'a> Freeze for Message<'a>
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§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more