Add support for logger per module filtering (#2873)

Add mfa to the meta data to suppor the Erlang Logger's per module / per app filtering
This commit is contained in:
Michael Schmidt 2019-09-05 21:09:10 -05:00 committed by Shawn
parent 6f4b8d637b
commit 2d99a1412e
2 changed files with 2 additions and 2 deletions

View File

@ -41,5 +41,5 @@
-define(LOG(Level, Format, Args),
begin
(logger:log(Level,#{},#{report_cb => fun(_) -> {'$logger_header'()++(Format), (Args)} end}))
(logger:log(Level,#{},#{report_cb => fun(_) -> {'$logger_header'()++(Format), (Args)} end, mfa => {?MODULE, ?FUNCTION_NAME, ?FUNCTION_ARITY}}))
end).

View File

@ -63,7 +63,7 @@ trace(publish, #message{topic = <<"$SYS/", _/binary>>}) ->
ignore;
trace(publish, #message{from = From, topic = Topic, payload = Payload})
when is_binary(From); is_atom(From) ->
emqx_logger:info(#{topic => Topic}, "PUBLISH to ~s: ~p", [Topic, Payload]).
emqx_logger:info(#{topic => Topic, mfa => {?MODULE, ?FUNCTION_NAME, ?FUNCTION_ARITY} }, "PUBLISH to ~s: ~p", [Topic, Payload]).
%% @doc Start to trace client_id or topic.
-spec(start_trace(trace_who(), logger:level(), string()) -> ok | {error, term()}).