pub struct Syslog { /* private fields */ }
Expand description

A common instance which describes the syslog state

Trait Implementations§

NON STANDARD FUNCTION

This function acting like openlog() but allows to open connection to the arbitrary object.

Arguments
  • @see openlog()

  • sock_path - AsRef Path a path to the unix datagram socket

This function can be used to update the facility name, for example after fork().

Arguments
  • ident - a new identity (up to 48 UTF8 chars)

Creates an instance which is implements core::fmt::Write.

Arguments
  • pri - a priority Priority (can be updated)
Returns

Error not supported

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 libc, closelog() will close the log

Similar to libc, syslog() sends data to syslog server.

Arguments
  • pri - a priority Priority

  • fmt - a string message. In C exists a functions with variable argumets amount. In Rust you should create your own macros like format!() or use format!()

Similar to syslog() and created for the compatability.

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The alignment of pointer.
The type for initializers.
Initializes a with the given initializer. Read more
Dereferences the given pointer. Read more
Mutably dereferences the given pointer. Read more
Drops the object pointed to by the given pointer. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.