Struct gelf::Message
[−]
[src]
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]
fn new(short_message: String) -> 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.
fn new_with_level(short_message: String, level: Level) -> Self
Construct a new log message with a defined level
All fields will use their defaults. This means usually Option::None.
fn short_message(&self) -> &String
Return the short_message
fn set_short_message(&mut self, msg: String) -> &mut Self
Set the short_message
fn full_message(&self) -> &Option<String>
Return the full_message
fn set_full_message(&mut self, msg: String) -> &mut Self
Set the full_message
fn clear_full_message(&mut self) -> &mut Self
fn timestamp(&self) -> &Option<DateTime<UTC>>
Return the timestamp
fn set_timestamp(&mut self, ts: DateTime<UTC>) -> &mut Self
Set the timestamp
fn clear_timestamp(&mut self) -> &mut Self
Clear the timestamp
fn level(&self) -> Level
Return the level
fn set_level(&mut self, level: Level) -> &mut Self
Set the level
fn metadata(&self, key: &str) -> Option<&String>
Return a metadata field with given key
fn all_metadata(&self) -> &HashMap<&'a str, String>
Return all metadata
fn set_metadata(&mut self, key: &'a str, value: String) -> Result<&mut Self>
Set a metadata field with given key to value