Skip to main content

create_syslog_layer

Macro create_syslog_layer 

Source
macro_rules! create_syslog_layer {
    ($enabled:expr, $log_level:expr) => { ... };
}
Expand description

Creates a syslog logging layer for Unix systems.

This macro conditionally creates a syslog logging layer based on the enabled flag. When enabled, it initializes a connection to the system’s syslog daemon using the Daemon facility and includes the process ID in log entries.

Platform Support: Unix-based systems only (Linux, macOS, etc.)

§Arguments

  • $enabled - Boolean expression indicating whether syslog logging should be enabled
  • $log_level - Log level filter to apply to the layer

§Returns

  • Some(Layer) - Configured syslog layer if enabled and initialization succeeds
  • None - If syslog logging is disabled

§Errors

Returns [RexLoggerError::InitializationError] if:

  • Failed to create CString for syslog identity
  • Failed to initialize syslog connection