SyslogBuilder

Struct SyslogBuilder 

Source
pub struct SyslogBuilder { /* private fields */ }
Expand description

A builder to configure and create an Syslog appender.

Implementations§

Source§

impl SyslogBuilder

Source

pub fn unix_stream(path: impl AsRef<Path>) -> Result<SyslogBuilder>

Available on Unix only.

Create a new syslog writer that sends messages to the given Unix stream socket.

Source

pub fn unix_datagram(path: impl AsRef<Path>) -> Result<SyslogBuilder>

Available on Unix only.

Create a new syslog writer that sends messages to the given Unix datagram socket.

Source

pub fn unix(path: impl AsRef<Path>) -> Result<SyslogBuilder>

Available on Unix only.

Create a new syslog writer that sends messages to the given Unix socket.

This method will automatically choose between unix_stream and unix_datagram based on the path.

Source§

impl SyslogBuilder

Source

pub fn new(sender: SyslogSender) -> Self

Create a new builder.

Source

pub fn build(self) -> Syslog

Build the Syslog appender.

Source

pub fn format(self, format: SyslogFormat) -> Self

Set the format of the Syslog appender.

Source

pub fn context(self, context: SyslogContext) -> Self

Set the context of the Syslog appender.

Source

pub fn layout(self, layout: impl Into<Box<dyn Layout>>) -> Self

Set the layout of the Syslog appender.

Default to None, the message will construct with only Record::payload.

Source

pub fn tcp_well_known() -> Result<SyslogBuilder>

Create a new syslog writer that sends messages to the well-known TCP port (514).

Source

pub fn tcp<A: ToSocketAddrs>(addr: A) -> Result<SyslogBuilder>

Create a new syslog writer that sends messages to the given TCP address.

Source

pub fn udp_well_known() -> Result<SyslogBuilder>

Create a new syslog writer that sends messages to the well-known UDP port (514).

Source

pub fn udp<L: ToSocketAddrs, R: ToSocketAddrs>( local: L, remote: R, ) -> Result<SyslogBuilder>

Create a new syslog writer that sends messages to the given UDP address.

Source

pub fn broadcast_well_known() -> Result<SyslogBuilder>

Create a new syslog writer that broadcast messages to the well-known UDP port (514).

Source

pub fn broadcast(port: u16) -> Result<SyslogBuilder>

Create a new syslog writer that broadcast messages to the given UDP address.

Trait Implementations§

Source§

impl Debug for SyslogBuilder

Source§

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

Formats the value using the given formatter. Read more

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

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>,

Source§

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.