anchor.diff:       ,{22, local6, "local use 6  (local6)"}
        ,{23, local7, "local use 7  (local7)"}].
   
  -facility_to_int(I) when is_integer(I) ->
  +-spec facility_to_int(facility()) -> 0..127.
  +facility_to_int(I)
  +  when is_integer(I), 0 =< I, I =< 127 ->
       I;
   facility_to_int(A) when is_atom(A) ->
       element(1, lists:keyfind(A, 2, facilities())).
   
  +-type severity() :: 0..7 |
  +                    'emergency' |
  +                    'alert' |
  +                    'critical' |
  +                    'error' |
  +                    'warning' |
  +                    'notice' |
  +                    'info' |
  +                    'debug'.
   severities() ->
       [ {0, emergency, "Emergency: system is unusable"}
        ,{1, alert, "Alert: action must be taken immediately"}
  
positive.code:      Process,
       io_lib:format(Fmt, Args)}.
  
  facilities() ->
      [ { 0, kernel, "kernel messages"}
       ,{ 1, user, "user-level messages"}
  
negative.code:     [ <<"<">>, pri(Facility, Severity), <<">1 ">>,
        Time, $\s, Token, $\s, Source, $\s, Process, <<" - - ">>, Msg ].
  
  rfc5424({Facility, Severity, Time, Source, Process, Msg}) ->
      rfc5424(Facility, Severity, Time, Source,
              Process, undefined, undefined, Msg).
  
  rfc5424(Facility, Severity, Time, Host, AppName, ProcID, MsgID, Msg) ->
      [ <<"<">>, pri(Facility, Severity), <<">1">>,
        [ [$\s, nvl(Item)]
          || Item <- [Time, Host, AppName, ProcID, MsgID] ],
        case Msg of
            undefined -> [];
            _ -> [$\s, Msg]
        end
      ].
  
  nvl(undefined) -> $-;
  nvl(Val) -> Val.
  
  
  from_msg(Msg) when is_binary(Msg) ->
      %% <40>1 2010-11-10T17:16:33-08:00 domU-12-31-39-13-74-02 t.xxx web.1 - - State changed from created to starting
      %% <PriFac>1 Time Host Token Process - - Msg
  