chore(src): fix elvis
This commit is contained in:
parent
a8558bc7b5
commit
3daefe954b
|
@ -230,7 +230,7 @@ setting_peercert_infos(Peercert, ClientInfo, Options) ->
|
||||||
|
|
||||||
-dialyzer([{nowarn_function, [peer_cert_as/5]}]).
|
-dialyzer([{nowarn_function, [peer_cert_as/5]}]).
|
||||||
% esockd_peercert:peercert is opaque
|
% esockd_peercert:peercert is opaque
|
||||||
% https://github.com/emqx/esockd/blob/9b959fc11a1c398a589892f335235be6c5b4a454/src/esockd_peercert.erl#L23
|
% https://github.com/emqx/esockd/blob/master/src/esockd_peercert.erl
|
||||||
peer_cert_as(Key, Options, Peercert, DN, CN) ->
|
peer_cert_as(Key, Options, Peercert, DN, CN) ->
|
||||||
case proplists:get_value(Key, Options) of
|
case proplists:get_value(Key, Options) of
|
||||||
cn -> CN;
|
cn -> CN;
|
||||||
|
|
|
@ -47,7 +47,7 @@
|
||||||
-define(TOPIC_TRACE(T), {topic, T}).
|
-define(TOPIC_TRACE(T), {topic, T}).
|
||||||
-define(CLIENT_TRACE(C), {clientid, C}).
|
-define(CLIENT_TRACE(C), {clientid, C}).
|
||||||
|
|
||||||
-define(is_log_level(L),
|
-define(IS_LOG_LEVEL(L),
|
||||||
L =:= emergency orelse
|
L =:= emergency orelse
|
||||||
L =:= alert orelse
|
L =:= alert orelse
|
||||||
L =:= critical orelse
|
L =:= critical orelse
|
||||||
|
@ -67,19 +67,24 @@ trace(publish, #message{topic = <<"$SYS/", _/binary>>}) ->
|
||||||
ignore;
|
ignore;
|
||||||
trace(publish, #message{from = From, topic = Topic, payload = Payload})
|
trace(publish, #message{from = From, topic = Topic, payload = Payload})
|
||||||
when is_binary(From); is_atom(From) ->
|
when is_binary(From); is_atom(From) ->
|
||||||
emqx_logger:info(#{topic => Topic, mfa => {?MODULE, ?FUNCTION_NAME, ?FUNCTION_ARITY} }, "PUBLISH to ~s: ~0p", [Topic, Payload]).
|
emqx_logger:info(#{topic => Topic,
|
||||||
|
mfa => {?MODULE, ?FUNCTION_NAME, ?FUNCTION_ARITY} },
|
||||||
|
"PUBLISH to ~s: ~0p", [Topic, Payload]).
|
||||||
|
|
||||||
%% @doc Start to trace clientid or topic.
|
%% @doc Start to trace clientid or topic.
|
||||||
-spec(start_trace(trace_who(), logger:level() | all, string()) -> ok | {error, term()}).
|
-spec(start_trace(trace_who(), logger:level() | all, string()) -> ok | {error, term()}).
|
||||||
start_trace(Who, all, LogFile) ->
|
start_trace(Who, all, LogFile) ->
|
||||||
start_trace(Who, debug, LogFile);
|
start_trace(Who, debug, LogFile);
|
||||||
start_trace(Who, Level, LogFile) ->
|
start_trace(Who, Level, LogFile) ->
|
||||||
case ?is_log_level(Level) of
|
case ?IS_LOG_LEVEL(Level) of
|
||||||
true ->
|
true ->
|
||||||
#{level := PrimaryLevel} = logger:get_primary_config(),
|
#{level := PrimaryLevel} = logger:get_primary_config(),
|
||||||
try logger:compare_levels(Level, PrimaryLevel) of
|
try logger:compare_levels(Level, PrimaryLevel) of
|
||||||
lt ->
|
lt ->
|
||||||
{error, io_lib:format("Cannot trace at a log level (~s) lower than the primary log level (~s)", [Level, PrimaryLevel])};
|
{error,
|
||||||
|
io_lib:format("Cannot trace at a log level (~s) "
|
||||||
|
"lower than the primary log level (~s)",
|
||||||
|
[Level, PrimaryLevel])};
|
||||||
_GtOrEq ->
|
_GtOrEq ->
|
||||||
install_trace_handler(Who, Level, LogFile)
|
install_trace_handler(Who, Level, LogFile)
|
||||||
catch
|
catch
|
||||||
|
|
Loading…
Reference in New Issue