pub struct SyslogShared<F: SyslogFormatter = DefaultSyslogFormatter, D: SyslogDestination = SyslogLocal> { /* private fields */ }
Expand description
A single instance shared between all threads. A Mutex is used to guard the instance.
For this isntance a SyslogApi and StreamableSyslogApi are implemented.
§Generics
-
F
- a SyslogFormatter which sets the instance which would format the message. -
D
- a SyslogDestination instance which is either: SyslogLocal, [SyslogFile], [SyslogNet], [SyslogTls]. By default aSyslogLocal
is selected.
Implementations§
Sourcepub fn openlog(
ident: Option<&str>,
logstat: LogStat,
facility: LogFacility,
net_tap_prov: SyslogLocal,
) -> SyRes<Self>
pub fn openlog( ident: Option<&str>, logstat: LogStat, facility: LogFacility, net_tap_prov: SyslogLocal, ) -> SyRes<Self>
Opens a default connection to the local syslog server with default formatter.
In order to access the syslog API, use the SyslogApi.
§Arguments
-
ident
- A program name which will appear on the logs. If none, will be determined automatically. -
logstat
- LogStat an instance config. -
facility
- LogFacility a syslog facility. -
net_tap_prov
- a SyslogLocal instance with configuration.
§Returns
A SyRes is returned (Result) with:
-
Result::Ok - with instance
-
Result::Err - with error description.
Sourcepub fn openlog_with(
ident: Option<&str>,
logstat: LogStat,
facility: LogFacility,
net_tap_prov: D,
) -> SyRes<SyslogShared<F, D>>
pub fn openlog_with( ident: Option<&str>, logstat: LogStat, facility: LogFacility, net_tap_prov: D, ) -> SyRes<SyslogShared<F, D>>
Opens a special connection to the destination syslog server with specific formatter.
All struct generic should be specified before calling this function.
In order to access the syslog API, use the SyslogApi.
§Arguments
-
ident
- A program name which will appear on the logs. If none, will be determined automatically. -
logstat
- LogStat an instance config. -
facility
- LogFacility a syslog facility. -
net_tap_prov
- a destination server. A specificD
instance which contains infomation about the destination server. Seesyslog_provider.rs
.
§Returns
A SyRes is returned (Result) with:
-
Result::Ok - with instance
-
Result::Err - with error description.
Trait Implementations§
Source§fn clone(&self) -> SyslogShared<F, D>
fn clone(&self) -> SyslogShared<F, D>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read morefn make_stream(&self, pri: Priority) -> Box<dyn SyslogStream>
Source§fn change_identity(&self, ident: &str) -> SyRes<()>
fn change_identity(&self, ident: &str) -> SyRes<()>
This function can be used to update the facility name, for example after fork().
§Arguments
ident
- a new identity (up to 48 UTF8 chars)
Source§fn connectlog(&self) -> SyRes<()>
fn connectlog(&self) -> SyRes<()>
Source§fn setlogmask(&self, logmask: i32) -> SyRes<i32>
fn setlogmask(&self, logmask: i32) -> SyRes<i32>
Source§fn syslog(&self, pri: Priority, fmt: F)
fn syslog(&self, pri: Priority, fmt: F)
Source§fn reconnect(&self) -> SyRes<()>
fn reconnect(&self) -> SyRes<()>
Source§fn update_tap_data(&self, tap_data: D) -> SyRes<()>
fn update_tap_data(&self, tap_data: D) -> SyRes<()>
tap_data
[TapTypeData] should be of
the same variant (type) as current.