Struct gelf_logger::ConfigBuilder
source · pub struct ConfigBuilder { /* private fields */ }
Expand description
Implementations§
source§impl ConfigBuilder
impl ConfigBuilder
sourcepub fn try_from_yaml(path: &str) -> Result<ConfigBuilder, Error>
pub fn try_from_yaml(path: &str) -> Result<ConfigBuilder, Error>
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();
sourcepub fn set_level(self, level: GelfLevel) -> ConfigBuilder
pub fn set_level(self, level: GelfLevel) -> ConfigBuilder
Sets threshold for this logger to level. Logging messages which are less severe than level will be ignored.
sourcepub fn set_hostname(self, hostname: String) -> ConfigBuilder
pub fn set_hostname(self, hostname: String) -> ConfigBuilder
Sets the hostname of the remote server.
sourcepub fn set_port(self, port: u64) -> ConfigBuilder
pub fn set_port(self, port: u64) -> ConfigBuilder
Sets the port of the remote server.
sourcepub fn set_null_character(self, null_character: bool) -> ConfigBuilder
pub fn set_null_character(self, null_character: bool) -> ConfigBuilder
Adds a NUL byte (\0
) after each entry.
sourcepub fn set_use_tls(self, use_tls: bool) -> ConfigBuilder
pub fn set_use_tls(self, use_tls: bool) -> ConfigBuilder
Activate transport security.
sourcepub fn set_async_buffer_size(self, async_buffer_size: usize) -> ConfigBuilder
pub fn set_async_buffer_size(self, async_buffer_size: usize) -> ConfigBuilder
Set the asynchronous buffer size. This buffer is placed between the log subsystem and the network sender. This represent the maximum number of message the system will buffer before blocking while waiting for message to be actually sent to the remote server.
Default: 1000
§Warning
This actually allocates a buffer of this size, if you set a high value here, is will eat a large amount of memory.
sourcepub fn set_buffer_size(self, buffer_size: usize) -> ConfigBuilder
pub fn set_buffer_size(self, buffer_size: usize) -> ConfigBuilder
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.
sourcepub fn set_buffer_duration(self, buffer_duration: Duration) -> ConfigBuilder
pub fn set_buffer_duration(self, buffer_duration: Duration) -> ConfigBuilder
Sets the maximum lifetime of the buffer before send it to the remote server.
sourcepub fn put_additional_field<V>(self, key: String, value: V) -> ConfigBuilder
pub fn put_additional_field<V>(self, key: String, value: V) -> ConfigBuilder
Adds an additional data which will be append to each log entry.
sourcepub fn extend_additional_fields(
self,
additional_fields: BTreeMap<Value, Value>
) -> ConfigBuilder
pub fn extend_additional_fields( self, additional_fields: BTreeMap<Value, Value> ) -> ConfigBuilder
Adds multiple additional data which will be append to each log entry.
sourcepub fn set_full_buffer_policy(
self,
policy: Option<FullBufferPolicy>
) -> ConfigBuilder
pub fn set_full_buffer_policy( self, policy: Option<FullBufferPolicy> ) -> ConfigBuilder
Set the policy to apply when async send buffer is full.
It is recommended to use the FullBufferPolicy::Discard
policy.
If not set or set to None
, FullBufferPolicy::Discard
will be used by
default
sourcepub fn set_connect_timeout(
self,
connect_timeout: Option<Duration>
) -> ConfigBuilder
pub fn set_connect_timeout( self, connect_timeout: Option<Duration> ) -> ConfigBuilder
Set the TCP connect timeout.
sourcepub fn set_write_timeout(self, write_timeout: Option<Duration>) -> ConfigBuilder
pub fn set_write_timeout(self, write_timeout: Option<Duration>) -> ConfigBuilder
Set the TCP write timeout.
Trait Implementations§
source§impl Clone for ConfigBuilder
impl Clone for ConfigBuilder
source§fn clone(&self) -> ConfigBuilder
fn clone(&self) -> ConfigBuilder
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more