fix(coap): log error level only when it error

This commit is contained in:
Zaiming Shi 2021-08-09 21:46:07 +02:00
parent dc2f6303d4
commit 0fb81c7e99
1 changed files with 5 additions and 2 deletions

View File

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