pub struct MessageBuilder { /* private fields */ }
Implementations§
Source§impl MessageBuilder
impl MessageBuilder
Sourcepub fn new() -> Self
pub fn new() -> Self
Creates a new MessageBuilder with the following defaults:
- Level -> Level’s default
- Author -> The hostname of the OS or ‘?’ if that cannot be retrieved
Sourcepub fn body<F>(&mut self, apply: F) -> &mut Selfwhere
F: FnOnce(&mut MessageDetailBuilder),
pub fn body<F>(&mut self, apply: F) -> &mut Selfwhere
F: FnOnce(&mut MessageDetailBuilder),
Add a message body to the message builder If not set it will be blank.
Sourcepub fn title<S: ToString>(&mut self, title: S) -> &mut Self
pub fn title<S: ToString>(&mut self, title: S) -> &mut Self
Sets the title of the message, If not set, will be blank.
Sourcepub fn component(&mut self, component: Component) -> &mut Self
pub fn component(&mut self, component: Component) -> &mut Self
Sets the Component of the message By default the component will be blank
Adds Author data to the message. By default this is just the hostname of OS running it (‘?’ if this cannot be retrieved) The argument parts is appended onto this hostname data (with a ‘/’)
Sourcepub fn timestamp(&mut self, unix_timestamp_millis: i64) -> &mut Self
pub fn timestamp(&mut self, unix_timestamp_millis: i64) -> &mut Self
Sets the timestamp of the message. This is set by default to the time which the MessageBuilder was created.
However, if you are using build_clone
you should be using this
if you don’t want your messages to all have the same timestamp.
Sourcepub fn build(self) -> Message
pub fn build(self) -> Message
Builds the message, consuming the MessageBuilder
If timestamp
has been set, it will be used,
otherwise the current time will be retrieved and used.
Sourcepub fn build_clone(&self) -> Message
pub fn build_clone(&self) -> Message
Builds a new message, without consuming the MessageBuilder
If timestamp
has been set, it will be used,
otherwise the current time will be retrieved and used.