[][src]Struct gelf_logger::ConfigBuilder

pub struct ConfigBuilder { /* fields omitted */ }

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]

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]

impl Debug for ConfigBuilder[src]

impl<'de> Deserialize<'de> for ConfigBuilder[src]

Auto Trait Implementations

Blanket Implementations

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = !

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: Deserialize<'de>, 
[src]