Przeglądaj źródła

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

Zaiming Shi 4 lat temu
rodzic
commit
0fb81c7e99

+ 5 - 2
apps/emqx_gateway/src/coap/resources/emqx_coap_pubsub_topics.erl

@@ -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}.