chore(audit): emit the message field
This commit is contained in:
parent
859b122cdd
commit
6d2adfc259
|
@ -61,9 +61,7 @@
|
|||
)
|
||||
end).
|
||||
|
||||
-define(AUDIT(_Level_, _From_, _Meta_), ?AUDIT(_Level_, _From_, undefined, _Meta_)).
|
||||
|
||||
-define(AUDIT(_Level_, _From_, _Msg_, _Meta_), begin
|
||||
-define(AUDIT(_Level_, _From_, _Meta_), begin
|
||||
case emqx_config:get([log, audit], #{enable => false}) of
|
||||
#{enable := false} ->
|
||||
ok;
|
||||
|
@ -73,7 +71,7 @@ end).
|
|||
emqx_trace:log(
|
||||
_Level_,
|
||||
[{emqx_audit, fun(L, _) -> L end, undefined, undefined}],
|
||||
{report, _Msg_},
|
||||
_Msg = undefined,
|
||||
_Meta_#{from => _From_}
|
||||
);
|
||||
gt ->
|
||||
|
|
|
@ -93,6 +93,8 @@ format(Msg, Meta, Config) ->
|
|||
end,
|
||||
emqx_utils_json:encode(json_obj_root(Data, Config)).
|
||||
|
||||
maybe_format_msg(undefined, _Meta, _Config) ->
|
||||
#{};
|
||||
maybe_format_msg({report, Report} = Msg, #{report_cb := Cb} = Meta, Config) ->
|
||||
case is_map(Report) andalso Cb =:= ?DEFAULT_FORMATTER of
|
||||
true ->
|
||||
|
|
|
@ -67,8 +67,9 @@ graceful() ->
|
|||
|
||||
%% @doc Shutdown the Erlang VM and wait indefinitely.
|
||||
graceful_wait() ->
|
||||
?AUDIT(alert, cli, run_emqx_stop_to_grace_shutdown, #{
|
||||
time => logger:timestamp()
|
||||
?AUDIT(alert, cli, #{
|
||||
time => logger:timestamp(),
|
||||
event => emqx_gracefully_stop
|
||||
}),
|
||||
ok = graceful(),
|
||||
exit_loop().
|
||||
|
|
Loading…
Reference in New Issue