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

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_rfc5424::parse_message;

let message = parse_message("<78>1 2016-01-15T00:04:01+00:00 host1 CROND 10391 - [meta sequenceId=\"29\"] some_message").unwrap();

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