Skip to main content

SyslogFormatter

Trait SyslogFormatter 

Source
pub trait SyslogFormatter:
    Debug
    + Send
    + Clone
    + From<String>
    + From<&'static str>
    + 'static {
    // Required method
    fn vsyslog1_format(
        &self,
        max_msg_size: usize,
        prifac: SyslogMsgPriFac,
        progname: &str,
        pid: Option<&str>,
    ) -> SyslogFormatted;
}
Expand description

A trait for the custom syslog formatter.

Required Methods§

Source

fn vsyslog1_format( &self, max_msg_size: usize, prifac: SyslogMsgPriFac, progname: &str, pid: Option<&str>, ) -> SyslogFormatted

Formats the message for the syslog server with specific protocol or RFC.

§Arguments
  • max_msg_size - a max msg size in bytes.

  • prifac - a SyslogMsgPriFac a prepared PRI header value.

  • progname - a ref to program name or identifier which is set during init.

  • pid - an Option value where inner constains a PID number already converted into string form. If Option::None is provided, a crate::LogStat::LOG_PID was not set during init. The formatter must exclude the PID from the report.

§Returns

A SyslogFormatted should be returned.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§