View Source NervesLogging.SyslogParser (nerves_logging v0.2.2)
Functions for parsing syslog strings
Summary
Functions
Decode a syslog priority to facility and severity
Parse out the syslog facility, severity, and message (including the timestamp and host) from a syslog-formatted string.
Types
@type facility() ::
:kernel
| :user_level
| :mail
| :system
| :security_authorization
| :syslogd
| :line_printer
| :network_news
| :UUCP
| :clock
| :security_authorization
| :FTP
| :NTP
| :log_audit
| :log_alert
| :clock
| :local0
| :local1
| :local2
| :local3
| :local4
| :local5
| :local6
| :local7
@type severity() ::
:alert | :critical | :debug | :emergency | :error | :info | :notice | :warning
Functions
Decode a syslog priority to facility and severity
@spec parse(String.t()) :: {:ok, %{facility: facility(), severity: severity(), message: binary()}} | {:error, :parse_error}
Parse out the syslog facility, severity, and message (including the timestamp and host) from a syslog-formatted string.
The message is of the form:
<pri>message
pri
is an integer that when broken apart gives you a facility and severity.
message
is everything else.