Struct gelf_logger::Config

source ·
pub struct Config { /* private fields */ }
Expand description

Struct to manipulate configuration.

Implementations§

source§

impl Config

source

pub fn try_from_yaml(path: &str) -> Result<Config, Error>

Load configuration using the given path file.

§Example
use gelf_logger::Config;

let config = Config::try_from_yaml("/tmp/myconf.yml").unwrap();
source

pub fn ldp(cluster: &str, token: &str) -> Config

Shortcut to create a valid configuration for OVH LDP service.

§Example
[dependencies.gelf_logger]
version = "*"
features = ["ovh-ldp"]

And then:

use gelf_logger::Config;

let cfg = Config::ldp("gra1.logs.ovh.com", "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX");
source

pub fn level(&self) -> GelfLevel

The threshold for this logger to level. Logging messages which are less severe than level will be ignored.

source

pub fn hostname(&self) -> &String

The name of the remote server.

source

pub fn port(&self) -> u64

The port of the remote host.

source

pub fn null_character(&self) -> bool

Adds a NUL byte (\0) after each entry.

source

pub fn use_tls(&self) -> bool

Activate transport security.

source

pub fn async_buffer_size(&self) -> Option<usize>

Get 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.

If None is configured, it defaults to 1000

source

pub fn buffer_size(&self) -> Option<usize>

Get 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.

source

pub fn buffer_duration(&self) -> Option<Duration>

Get the maximum lifetime of the buffer before send it to the remote server.

source

pub fn additional_fields(&self) -> &BTreeMap<Value, Value>

Every additional data which will be append to each log entry.

source

pub fn full_buffer_policy(&self) -> Option<FullBufferPolicy>

Get the full buffer policy

source

pub fn write_timeout(&self) -> Option<Duration>

Get the write timeout

source

pub fn connect_timeout(&self) -> Option<Duration>

Get the connect timeout

source

pub fn builder() -> ConfigBuilder

Returns a new builder.

Trait Implementations§

source§

impl Clone for Config

source§

fn clone(&self) -> Config

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Config

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'de> Deserialize<'de> for Config

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl From<&Config> for GelfTcpOutput

source§

fn from(cfg: &Config) -> GelfTcpOutput

Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

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