Function syslog_rfc3164::parser::parse_message [] [src]

pub fn parse_message<S: AsRef<str>>(s: S) -> Result<SyslogMessage, ParseErr>

Parse a string into a SyslogMessage object

Arguments

  • s: Anything convertible to a string

Returns

  • ParseErr if the string is not parseable as an RFC5424 message

Example

use syslog_rfc3164::parse_message;

let message = parse_message("<78>Mar 15 14:16:22 host1 CROND 10391 - [meta sequenceId=\"29\"] some_message").unwrap();

assert!(message.hostname.unwrap() == "host1");