View Source Nerves.Runtime.Log.SyslogParser (nerves_runtime v0.11.9)

Functions for parsing syslog strings

Link to this section 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.

Convert severity to an Elixir logger level

Link to this section Types

Specs

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

Specs

severity() ::
  :alert
  | :critical
  | :debug
  | :emergency
  | :error
  | :informational
  | :notice
  | :warning

Link to this section Functions

Link to this function

decode_priority(priority)

View Source

Specs

decode_priority(0..191) ::
  {:ok, facility(), severity()} | {:error, :parse_error}

Decode a syslog priority to facility and severity

Specs

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.

Link to this function

severity_to_logger(severity)

View Source

Specs

severity_to_logger(severity()) :: Logger.level()

Convert severity to an Elixir logger level