Change log level unexpected info in client (#2422)
Change log level for unexpected info in client and rejust code format in emqx_bridge
This commit is contained in:
parent
6a4c318acb
commit
4fc81cef85
|
@ -323,10 +323,9 @@ connecting(enter, _, #{reconnect_delay_ms := Timeout,
|
||||||
{ok, ConnRef, Conn} ->
|
{ok, ConnRef, Conn} ->
|
||||||
?LOG(info, "[Bridge] Bridge ~p connected", [name()]),
|
?LOG(info, "[Bridge] Bridge ~p connected", [name()]),
|
||||||
Action = {state_timeout, 0, connected},
|
Action = {state_timeout, 0, connected},
|
||||||
{keep_state,
|
State0 = State#{conn_ref => ConnRef, connection => Conn},
|
||||||
eval_bridge_handler(State#{ conn_ref => ConnRef
|
State1 = eval_bridge_handler(State0, connected),
|
||||||
, connection => Conn}, connected),
|
{keep_state, State1, Action};
|
||||||
Action};
|
|
||||||
error ->
|
error ->
|
||||||
Action = {state_timeout, Timeout, reconnect},
|
Action = {state_timeout, Timeout, reconnect},
|
||||||
{keep_state_and_data, Action}
|
{keep_state_and_data, Action}
|
||||||
|
@ -424,7 +423,7 @@ common(StateName, Type, Content, State) ->
|
||||||
eval_bridge_handler(State = #{bridge_handler := ?NO_BRIDGE_HANDLER}, _Msg) ->
|
eval_bridge_handler(State = #{bridge_handler := ?NO_BRIDGE_HANDLER}, _Msg) ->
|
||||||
State;
|
State;
|
||||||
eval_bridge_handler(State = #{bridge_handler := Handler}, Msg) ->
|
eval_bridge_handler(State = #{bridge_handler := Handler}, Msg) ->
|
||||||
_ = Handler(Msg),
|
Handler(Msg),
|
||||||
State.
|
State.
|
||||||
|
|
||||||
ensure_present(Key, Topic, State) ->
|
ensure_present(Key, Topic, State) ->
|
||||||
|
@ -564,9 +563,8 @@ disconnect(#{connection := Conn,
|
||||||
connect_module := Module
|
connect_module := Module
|
||||||
} = State) when Conn =/= undefined ->
|
} = State) when Conn =/= undefined ->
|
||||||
ok = Module:stop(ConnRef, Conn),
|
ok = Module:stop(ConnRef, Conn),
|
||||||
eval_bridge_handler(State#{conn_ref => undefined,
|
State0 = State#{conn_ref => undefined, connection => undefined},
|
||||||
connection => undefined},
|
eval_bridge_handler(State0, disconnected);
|
||||||
disconnected);
|
|
||||||
disconnect(State) ->
|
disconnect(State) ->
|
||||||
eval_bridge_handler(State, disconnected).
|
eval_bridge_handler(State, disconnected).
|
||||||
|
|
||||||
|
|
|
@ -928,6 +928,11 @@ handle_event(info, {inet_reply, _Sock, {error, Reason}}, _, State) ->
|
||||||
?LOG(error, "[Client] Got tcp error: ~p", [Reason]),
|
?LOG(error, "[Client] Got tcp error: ~p", [Reason]),
|
||||||
{stop, {shutdown, Reason}, State};
|
{stop, {shutdown, Reason}, State};
|
||||||
|
|
||||||
|
handle_event(info, EventContent = {'EXIT', _Pid, normal}, StateName, _State) ->
|
||||||
|
?LOG(error, "[Client] State: ~s, Unexpected Event: (info, ~p)",
|
||||||
|
[StateName, EventContent]),
|
||||||
|
keep_state_and_data;
|
||||||
|
|
||||||
handle_event(EventType, EventContent, StateName, _StateData) ->
|
handle_event(EventType, EventContent, StateName, _StateData) ->
|
||||||
?LOG(error, "[Client] State: ~s, Unexpected Event: (~p, ~p)",
|
?LOG(error, "[Client] State: ~s, Unexpected Event: (~p, ~p)",
|
||||||
[StateName, EventType, EventContent]),
|
[StateName, EventType, EventContent]),
|
||||||
|
|
Loading…
Reference in New Issue