Struct syslog_rs::syslog_sync_queue::Syslog [−][src]
pub struct Syslog { /* fields omitted */ }
Expand description
A common instance which describes the syslog state
Implementations
As in a libc, this function initializes the syslog instance. The main difference with realization in C is it returns the instance to program used this crate. This structure implements the Send and Sync so it does not require any additional synchonization.
Arguments
-
ident
- a identification of the sender. If not set, the crate will determine automatically! -
logstat
- sets up the syslog behaviour. Use LogStat -
facility
- a syslog facility. Use LogFacility
Returns
- A SyRes with instance or Err()
Example
Syslog::openlog( Some("test1"), LogStat::LOG_NDELAY | LogStat::LOG_PID, LogFacility::LOG_DAEMON);
Sets the logmask to filter out the syslog calls. This function behaves differently as it behaves in syslog_sync.rs or syslog_async.rs. It may return an error if: syslog thread had exit and some thread calls this function. Or something happened with channel. This function blocks until the previous mask is received.
See macroses LOG_MASK and LOG_UPTO to generate mask
Example
LOG_MASK!(Priority::LOG_EMERG) | LOG_MASK!(Priority::LOG_ERROR)
or
~(LOG_MASK!(Priority::LOG_INFO)) LOG_UPTO!(Priority::LOG_ERROR)
Similar to syslog() and created for the compatability.
This function can be used to update the facility name, for example after fork().
Arguments
ident
- a new identity (up to 48 UTF8 chars)