Logfmt

Summary

decode(string)

Decodes the given line into a map

encode(map)

Encodes the given map into a Logfmt-style line

Functions

decode(string)

Specs:

Decodes the given line into a map

Examples

iex> Logfmt.decode "foo=bar baz=qux"
%{"foo" => "bar", "baz" => "qux"}

iex> Logfmt.decode ~s(foo="bar baz")
%{"foo" => "bar baz"}

iex> Logfmt.decode "foo=true"
%{"foo" => true}

iex> Logfmt.decode "foo=1"
%{"foo" => 1}
encode(map)

Specs:

Encodes the given map into a Logfmt-style line

Examples

iex> Logfmt.encode %{foo: "bar"}
"foo=bar"

iex> Logfmt.encode %{foo: "bar baz"}
"foo=\"bar baz\""