parent
e6d90d5758
commit
a3fd8846a5
|
@ -174,7 +174,7 @@ to_list(Msg) ->
|
||||||
to_bin_key_list(Msg) ->
|
to_bin_key_list(Msg) ->
|
||||||
lists:zipwith(
|
lists:zipwith(
|
||||||
fun(Key, Val) ->
|
fun(Key, Val) ->
|
||||||
{bin(Key), Val}
|
{bin(Key), bin_key_map(Val)}
|
||||||
end, record_info(fields, message), tl(tuple_to_list(Msg))).
|
end, record_info(fields, message), tl(tuple_to_list(Msg))).
|
||||||
|
|
||||||
%% MilliSeconds
|
%% MilliSeconds
|
||||||
|
@ -192,6 +192,13 @@ format(flags, Flags) ->
|
||||||
format(headers, Headers) ->
|
format(headers, Headers) ->
|
||||||
io_lib:format("~p", [Headers]).
|
io_lib:format("~p", [Headers]).
|
||||||
|
|
||||||
|
bin_key_map(Map) when is_map(Map) ->
|
||||||
|
maps:fold(fun(Key, Val, Acc) ->
|
||||||
|
Acc#{bin(Key) => bin_key_map(Val)}
|
||||||
|
end, #{}, Map);
|
||||||
|
bin_key_map(Data) ->
|
||||||
|
Data.
|
||||||
|
|
||||||
bin(Bin) when is_binary(Bin) -> Bin;
|
bin(Bin) when is_binary(Bin) -> Bin;
|
||||||
bin(Atom) when is_atom(Atom) -> list_to_binary(atom_to_list(Atom));
|
bin(Atom) when is_atom(Atom) -> list_to_binary(atom_to_list(Atom));
|
||||||
bin(Str) when is_list(Str) -> list_to_binary(Str).
|
bin(Str) when is_list(Str) -> list_to_binary(Str).
|
||||||
|
|
Loading…
Reference in New Issue