|
|
@@ -279,7 +279,7 @@ standing_by(state_timeout, do_connect, State) ->
|
|
|
standing_by({call, From}, _Call, _State) ->
|
|
|
{keep_state_and_data, [{reply, From, {error,standing_by}}]};
|
|
|
standing_by(info, Info, State) ->
|
|
|
- ?INFO("Portal ~p discarded info event at state standing_by:\n~p", [name(), Info]),
|
|
|
+ ?LOG(info, "Portal ~p discarded info event at state standing_by:\n~p", [name(), Info]),
|
|
|
{keep_state_and_data, State};
|
|
|
standing_by(Type, Content, State) ->
|
|
|
common(standing_by, Type, Content, State).
|
|
|
@@ -298,7 +298,7 @@ connecting(enter, _, #{reconnect_delay_ms := Timeout,
|
|
|
ok = subscribe_local_topics(Forwards),
|
|
|
case ConnectFun(Subs) of
|
|
|
{ok, ConnRef, Conn} ->
|
|
|
- ?INFO("Portal ~p connected", [name()]),
|
|
|
+ ?LOG(info, "Portal ~p connected", [name()]),
|
|
|
Action = {state_timeout, 0, connected},
|
|
|
{keep_state, State#{conn_ref => ConnRef, connection => Conn}, Action};
|
|
|
error ->
|
|
|
@@ -348,7 +348,7 @@ connected(info, {disconnected, ConnRef, Reason},
|
|
|
#{conn_ref := ConnRefCurrent, connection := Conn} = State) ->
|
|
|
case ConnRefCurrent =:= ConnRef of
|
|
|
true ->
|
|
|
- ?INFO("Portal ~p diconnected~nreason=~p", [name(), Conn, Reason]),
|
|
|
+ ?LOG(info, "Portal ~p diconnected~nreason=~p", [name(), Conn, Reason]),
|
|
|
{next_state, connecting,
|
|
|
State#{conn_ref := undefined, connection := undefined}};
|
|
|
false ->
|
|
|
@@ -360,7 +360,7 @@ connected(info, {batch_ack, Ref}, State) ->
|
|
|
keep_state_and_data;
|
|
|
bad_order ->
|
|
|
%% try re-connect then re-send
|
|
|
- ?ERROR("Bad order ack received by portal ~p", [name()]),
|
|
|
+ ?LOG(error, "Bad order ack received by portal ~p", [name()]),
|
|
|
{next_state, connecting, disconnect(State)};
|
|
|
{ok, NewState} ->
|
|
|
{keep_state, NewState, ?maybe_send}
|
|
|
@@ -391,7 +391,7 @@ common(_StateName, info, {dispatch, _, Msg},
|
|
|
NewQ = replayq:append(Q, collect([Msg])),
|
|
|
{keep_state, State#{replayq => NewQ}, ?maybe_send};
|
|
|
common(StateName, Type, Content, State) ->
|
|
|
- ?INFO("Portal ~p discarded ~p type event at state ~p:\n~p",
|
|
|
+ ?LOG(info, "Portal ~p discarded ~p type event at state ~p:\n~p",
|
|
|
[name(), Type, StateName, Content]),
|
|
|
{keep_state, State}.
|
|
|
|
|
|
@@ -462,7 +462,7 @@ retry_inflight(#{inflight := Inflight} = State,
|
|
|
{ok, NewState} ->
|
|
|
retry_inflight(NewState, T);
|
|
|
{error, Reason} ->
|
|
|
- ?ERROR("Inflight retry failed\n~p", [Reason]),
|
|
|
+ ?LOG(error, "Inflight retry failed\n~p", [Reason]),
|
|
|
{error, State#{inflight := Inflight ++ Remain}}
|
|
|
end.
|
|
|
|
|
|
@@ -493,7 +493,7 @@ do_send(State = #{inflight := Inflight}, QAckRef, [_ | _] = Batch) ->
|
|
|
batch => Batch}],
|
|
|
{ok, State#{inflight := NewInflight}};
|
|
|
{error, Reason} ->
|
|
|
- ?INFO("Batch produce failed\n~p", [Reason]),
|
|
|
+ ?LOG(info, "Batch produce failed\n~p", [Reason]),
|
|
|
{error, State}
|
|
|
end.
|
|
|
|