Merge pull request #5437 from zmstone/fix-emqx_coap_pubsub_topics-log-level

fix(coap): log error level only when it is error
This commit is contained in:
Zaiming (Stone) Shi 2021-08-10 06:29:59 +02:00 committed by GitHub
commit cc7447d9c1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 2 deletions

View File

@ -154,8 +154,11 @@ handle_info(Info, State) ->
terminate(Reason, #state{}) -> terminate(Reason, #state{}) ->
ets:delete(?COAP_TOPIC_TABLE), ets:delete(?COAP_TOPIC_TABLE),
?LOG(error, "the ~p terminate for reason ~p", [?MODULE, Reason]), Level = case Reason =:= normal orelse Reason =:= shutdown of
ok. true -> debug;
false -> error
end,
?SLOG(Level, #{terminate_reason => Reason}).
code_change(_OldVsn, State, _Extra) -> code_change(_OldVsn, State, _Extra) ->
{ok, State}. {ok, State}.