Skip to content

Commit

Permalink
better logs
Browse files Browse the repository at this point in the history
  • Loading branch information
lattenwald committed Nov 29, 2021
1 parent 19f26b8 commit 24bc0a5
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/tdlib.erl
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ handle_info({received, null}, State) ->
self() ! poll,
{noreply, State};
handle_info({received, {ok, Msg}}, State = #state{extra = Extra, handlers = Handlers}) ->
lager:debug("recv: ~p", [Msg]),
lager:debug("[~p] recv: ~p", [self(), Msg]),
Data = jsx:decode(Msg, [{return_maps, true}]),

{SyncReply, NewExtra} =
Expand All @@ -324,7 +324,7 @@ handle_info({received, {ok, Msg}}, State = #state{extra = Extra, handlers = Hand
end
end,

lager:debug("Received: ~ts", [Msg]),
lager:debug("[~p] Received: ~ts", [self(), Msg]),

case SyncReply of
null ->
Expand All @@ -342,7 +342,7 @@ handle_info({received, {ok, Msg}}, State = #state{extra = Extra, handlers = Hand
sets:to_list(Handlers)
);
{ReplyTo, TRef} ->
lager:debug("ReplyTo: ~p, TRef: ~p", [ReplyTo, TRef]),
lager:debug("[~p] ReplyTo: ~p, TRef: ~p", [self(), ReplyTo, TRef]),
timer:cancel(TRef),
gen_server:reply(ReplyTo, Data)
end,
Expand Down Expand Up @@ -427,7 +427,7 @@ handle_cast(send_config, State = #state{config = Config}) when Config /= null ->
handle_cast({auth_state, AuthState}, State) ->
{noreply, State#state{auth_state = AuthState}};
handle_cast({send, Request}, State = #state{tdlib = Tdlib}) ->
lager:debug("Sending: ~ts", [Request]),
lager:debug("[~p] Sending: ~ts", [self(), Request]),
tdlib_nif:send(Tdlib, Request),
{noreply, State};
handle_cast(
Expand Down Expand Up @@ -491,18 +491,18 @@ handle_auth(Pid, Data) ->
)
);
<<"setAuthenticationPhoneNumber">> ->
lager:info("Waiting for phone number");
lager:info("[~p] Waiting for phone number", [self()]);
<<"checkAuthenticationCode">> ->
lager:info("Waiiting for authentication code");
lager:info("[~p] Waiting for authentication code", [self()]);
<<"checkAuthenticationPassword">> ->
lager:info("Waiiting for password");
lager:info("[~p] Waiting for password", [self()]);
_ ->
ok
end.

%% @private
set_auth_state(Pid, AuthStateType) ->
lager:info("setting auth state to ~p", [AuthStateType]),
lager:info("[~p] setting auth state to ~p", [Pid, AuthStateType]),
gen_server:cast(Pid, {auth_state, AuthStateType}).

%% @private
Expand Down

0 comments on commit 24bc0a5

Please sign in to comment.