[−][src]Struct gelf_logger::ConfigBuilder
Builder for Config
.
The ConfigBuilder can set the different parameters of Config object, and returns the created object when build is called.
Example
use gelf_logger::ConfigBuilder; let cfg = ConfigBuilder::new() .set_hostname("localhost".into()) .build();
Methods
impl ConfigBuilder
[src]
pub fn try_from_yaml(path: &str) -> Result<ConfigBuilder, Error>
[src]
Load configuration using the given path
file.
Example
use gelf_logger::ConfigBuilder; let config = ConfigBuilder::try_from_yaml("/tmp/myconf.yml") .expect("Invalid config file!") .build();
pub fn new() -> ConfigBuilder
[src]
Construct new ConfigBuilder.
Defaults values are:
- level:
GelfLevel::Alert
- hostname: "127.0.0.1"
- port: 12202
- null_character: true
- use_tls: true
- buffer_size: None
- buffer_duration: None
- additional_fields: empty BTreeMap
pub fn set_level(self, level: GelfLevel) -> ConfigBuilder
[src]
Sets threshold for this logger to level. Logging messages which are less severe than level will be ignored.
pub fn set_hostname(self, hostname: String) -> ConfigBuilder
[src]
Sets the hostname of the remote server.
pub fn set_port(self, port: u64) -> ConfigBuilder
[src]
Sets the port of the remote server.
pub fn set_null_character(self, null_character: bool) -> ConfigBuilder
[src]
Adds a NUL byte (\0
) after each entry.
pub fn set_use_tls(self, use_tls: bool) -> ConfigBuilder
[src]
Activate transport security.
pub fn set_buffer_size(self, buffer_size: usize) -> ConfigBuilder
[src]
Sets the upperbound limit on the number of records that can be placed in the buffer, once this size has been reached, the buffer will be sent to the remote server.
pub fn set_buffer_duration(self, buffer_duration: u64) -> ConfigBuilder
[src]
Sets the maximum lifetime (in milli seconds) of the buffer before send it to the remote server.
pub fn put_additional_field(self, key: String, value: Value) -> ConfigBuilder
[src]
Adds an additional data which will be append to each log entry.
pub fn extend_additional_fields(
self,
additional_fields: BTreeMap<Value, Value>
) -> ConfigBuilder
[src]
self,
additional_fields: BTreeMap<Value, Value>
) -> ConfigBuilder
Adds multiple additional data which will be append to each log entry.
pub fn build(self) -> Config
[src]
Invoke the builder and return a Config
Trait Implementations
impl Clone for ConfigBuilder
[src]
fn clone(&self) -> ConfigBuilder
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for ConfigBuilder
[src]
impl<'de> Deserialize<'de> for ConfigBuilder
[src]
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
Auto Trait Implementations
impl Send for ConfigBuilder
impl Sync for ConfigBuilder
impl Unpin for ConfigBuilder
impl UnwindSafe for ConfigBuilder
impl RefUnwindSafe for ConfigBuilder
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
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 = !
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<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> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> DeserializeOwned for T where
T: Deserialize<'de>,
[src]
T: Deserialize<'de>,