[−][src]Struct gelf::Message
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]
S: Into<Cow<'a, str>> + AsRef<str>,
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]
S: Into<Cow<'a, str>> + AsRef<str>,
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]
S: Into<Cow<'a, str>> + AsRef<str>,
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]
S: Into<Cow<'a, str>> + AsRef<str>,
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]
S: Into<Cow<'a, str>> + AsRef<str>,
T: Into<Cow<'a, str>> + AsRef<str>,
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]
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
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]
fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
__S: Serializer,
[src]
__S: Serializer,
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]
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> DeserializeOwned for T where
T: Deserialize<'de>,
[src]
T: Deserialize<'de>,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
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>,