pub struct Builder { /* private fields */ }
Expand description
A builder for Logger
.
Implementations§
Source§impl Builder
impl Builder
Sourcepub fn additional_field<K, V>(self, key: K, value: V) -> Self
pub fn additional_field<K, V>(self, key: K, value: V) -> Self
Adds a persistent additional field to the GELF messages.
Sourcepub fn default_short_message<V: ToString>(self, short_message: V) -> Self
pub fn default_short_message<V: ToString>(self, short_message: V) -> Self
Sets the ‘short_message’ field’s default value. Defaults to “null”.
Logger
uses the default value for short_message
when an event does not specify
message
or short_message
in its fields.
Sourcepub fn version<V>(self, version: V) -> Selfwhere
V: ToString,
pub fn version<V>(self, version: V) -> Selfwhere
V: ToString,
Sets the GELF version number. Defaults to “1.1”.
Sourcepub fn host<V>(self, host: V) -> Selfwhere
V: ToString,
pub fn host<V>(self, host: V) -> Selfwhere
V: ToString,
Sets the host
field. Defaults to the system’s host name.
Sourcepub fn line_numbers(self, value: bool) -> Self
pub fn line_numbers(self, value: bool) -> Self
Sets whether line numbers should be logged. Defaults to true.
Sourcepub fn file_names(self, value: bool) -> Self
pub fn file_names(self, value: bool) -> Self
Sets whether file names should be logged. Defaults to true.
Sourcepub fn module_paths(self, value: bool) -> Self
pub fn module_paths(self, value: bool) -> Self
Sets whether module paths should be logged. Defaults to true.
Sourcepub fn connect_udp<A>(
self,
addr: A,
) -> Result<(Logger, ConnectionHandle<A, UdpConnection>), BuilderError>
pub fn connect_udp<A>( self, addr: A, ) -> Result<(Logger, ConnectionHandle<A, UdpConnection>), BuilderError>
Returns a Logger
and its UDP ConnectionHandle
.
Sourcepub fn connect_tcp<A>(
self,
addr: A,
) -> Result<(Logger, ConnectionHandle<A, TcpConnection>), BuilderError>
pub fn connect_tcp<A>( self, addr: A, ) -> Result<(Logger, ConnectionHandle<A, TcpConnection>), BuilderError>
Returns a Logger
and its TCP ConnectionHandle
.
Sourcepub fn init_udp_with_subscriber<S, A>(
self,
addr: A,
subscriber: S,
) -> Result<ConnectionHandle<A, UdpConnection>, BuilderError>where
S: Subscriber + for<'a> LookupSpan<'a> + Send + Sync + 'static,
A: ToSocketAddrs + Send + Sync + 'static,
pub fn init_udp_with_subscriber<S, A>(
self,
addr: A,
subscriber: S,
) -> Result<ConnectionHandle<A, UdpConnection>, BuilderError>where
S: Subscriber + for<'a> LookupSpan<'a> + Send + Sync + 'static,
A: ToSocketAddrs + Send + Sync + 'static,
Initialize logging with a given Subscriber
and returns its UDP ConnectionHandle
.
Sourcepub fn init_tcp_with_subscriber<A, S>(
self,
addr: A,
subscriber: S,
) -> Result<ConnectionHandle<A, TcpConnection>, BuilderError>where
A: ToSocketAddrs + Send + Sync + 'static,
S: Subscriber + for<'a> LookupSpan<'a> + Send + Sync + 'static,
pub fn init_tcp_with_subscriber<A, S>(
self,
addr: A,
subscriber: S,
) -> Result<ConnectionHandle<A, TcpConnection>, BuilderError>where
A: ToSocketAddrs + Send + Sync + 'static,
S: Subscriber + for<'a> LookupSpan<'a> + Send + Sync + 'static,
Initializes logging with a given Subscriber
and returns its TCP ConnectionHandle
.
Sourcepub fn init_tcp<A>(
self,
addr: A,
) -> Result<ConnectionHandle<A, TcpConnection>, BuilderError>
pub fn init_tcp<A>( self, addr: A, ) -> Result<ConnectionHandle<A, TcpConnection>, BuilderError>
Initializes TCP logging and returns its ConnectionHandle
.
Sourcepub fn init_udp<A>(
self,
addr: A,
) -> Result<ConnectionHandle<A, UdpConnection>, BuilderError>
pub fn init_udp<A>( self, addr: A, ) -> Result<ConnectionHandle<A, UdpConnection>, BuilderError>
Initialize UDP logging and returns its ConnectionHandle
.