Make logging messages more consistent

This commit is contained in:
Evgeny Khramtsov 2019-06-24 20:32:34 +03:00
parent 370226417a
commit a3e0cbbdd8
76 changed files with 231 additions and 232 deletions

View File

@ -54,11 +54,11 @@ handle_call(_Request, _From, State) ->
{stop, {unexpected_call, _Request, _From}, State}. {stop, {unexpected_call, _Request, _From}, State}.
handle_cast(_Msg, State) -> handle_cast(_Msg, State) ->
?WARNING_MSG("unexpected cast: ~p", [_Msg]), ?WARNING_MSG("Unexpected cast: ~p", [_Msg]),
{noreply, State}. {noreply, State}.
handle_info(_Info, State) -> handle_info(_Info, State) ->
?WARNING_MSG("unexpected info: ~p", [_Info]), ?WARNING_MSG("Unexpected info: ~p", [_Info]),
{noreply, State}. {noreply, State}.
terminate(_Reason, _State) -> terminate(_Reason, _State) ->

View File

@ -398,7 +398,7 @@ decode(Json) ->
-spec failed_http_request({ok, _} | {error, _}, url()) -> {error, _}. -spec failed_http_request({ok, _} | {error, _}, url()) -> {error, _}.
failed_http_request({ok, {{_, Code, Reason}, _Head, Body}}, Url) -> failed_http_request({ok, {{_, Code, Reason}, _Head, Body}}, Url) ->
?ERROR_MSG("Got unexpected status code from <~s>: ~B, Body: ~s", ?ERROR_MSG("Unexpected status code from <~s>: ~B, Body: ~s",
[Url, Code, Body]), [Url, Code, Body]),
throw({error, {unexpected_code, Code, Reason}}); throw({error, {unexpected_code, Code, Reason}});
failed_http_request({error, Reason}, Url) -> failed_http_request({error, Reason}, Url) ->

View File

@ -144,7 +144,7 @@ handle_cast(config_reloaded, #state{host_modules = HostModules} = State) ->
init_cache(NewHostModules), init_cache(NewHostModules),
{noreply, State#state{host_modules = NewHostModules}}; {noreply, State#state{host_modules = NewHostModules}};
handle_cast(Msg, State) -> handle_cast(Msg, State) ->
?WARNING_MSG("unexpected cast: ~p", [Msg]), ?WARNING_MSG("Unexpected cast: ~p", [Msg]),
{noreply, State}. {noreply, State}.
handle_info(_Info, State) -> handle_info(_Info, State) ->

View File

@ -309,14 +309,14 @@ init([#body{attrs = Attrs}, IP, SID]) ->
end. end.
wait_for_session(_Event, State) -> wait_for_session(_Event, State) ->
?ERROR_MSG("unexpected event in 'wait_for_session': ~p", ?ERROR_MSG("Unexpected event in 'wait_for_session': ~p",
[_Event]), [_Event]),
{next_state, wait_for_session, State}. {next_state, wait_for_session, State}.
wait_for_session(#body{attrs = Attrs} = Req, From, wait_for_session(#body{attrs = Attrs} = Req, From,
State) -> State) ->
RID = get_attr(rid, Attrs), RID = get_attr(rid, Attrs),
?DEBUG("got request:~n** RequestID: ~p~n** Request: " ?DEBUG("Got request:~n** RequestID: ~p~n** Request: "
"~p~n** From: ~p~n** State: ~p", "~p~n** From: ~p~n** State: ~p",
[RID, Req, From, State]), [RID, Req, From, State]),
Wait = min(get_attr(wait, Attrs, undefined), Wait = min(get_attr(wait, Attrs, undefined),
@ -368,20 +368,20 @@ wait_for_session(#body{attrs = Attrs} = Req, From,
From) From)
end; end;
wait_for_session(_Event, _From, State) -> wait_for_session(_Event, _From, State) ->
?ERROR_MSG("unexpected sync event in 'wait_for_session': ~p", ?ERROR_MSG("Unexpected sync event in 'wait_for_session': ~p",
[_Event]), [_Event]),
{reply, {error, badarg}, wait_for_session, State}. {reply, {error, badarg}, wait_for_session, State}.
active({#body{} = Body, From}, State) -> active({#body{} = Body, From}, State) ->
active1(Body, From, State); active1(Body, From, State);
active(_Event, State) -> active(_Event, State) ->
?ERROR_MSG("unexpected event in 'active': ~p", ?ERROR_MSG("Unexpected event in 'active': ~p",
[_Event]), [_Event]),
{next_state, active, State}. {next_state, active, State}.
active(#body{attrs = Attrs, size = Size} = Req, From, active(#body{attrs = Attrs, size = Size} = Req, From,
State) -> State) ->
?DEBUG("got request:~n** Request: ~p~n** From: " ?DEBUG("Got request:~n** Request: ~p~n** From: "
"~p~n** State: ~p", "~p~n** State: ~p",
[Req, From, State]), [Req, From, State]),
{ShaperState, Pause} = {ShaperState, Pause} =
@ -409,7 +409,7 @@ active(#body{attrs = Attrs, size = Size} = Req, From,
true -> active1(Req, From, State1) true -> active1(Req, From, State1)
end; end;
active(_Event, _From, State) -> active(_Event, _From, State) ->
?ERROR_MSG("unexpected sync event in 'active': ~p", ?ERROR_MSG("Unexpected sync event in 'active': ~p",
[_Event]), [_Event]),
{reply, {error, badarg}, active, State}. {reply, {error, badarg}, active, State}.
@ -518,7 +518,7 @@ handle_event({change_shaper, Shaper}, StateName,
State) -> State) ->
{next_state, StateName, State#state{shaper_state = Shaper}}; {next_state, StateName, State#state{shaper_state = Shaper}};
handle_event(_Event, StateName, State) -> handle_event(_Event, StateName, State) ->
?ERROR_MSG("unexpected event in '~s': ~p", ?ERROR_MSG("Unexpected event in '~s': ~p",
[StateName, _Event]), [StateName, _Event]),
{next_state, StateName, State}. {next_state, StateName, State}.
@ -558,7 +558,7 @@ handle_sync_event(deactivate_socket, _From, StateName,
{reply, ok, StateName, {reply, ok, StateName,
StateData#state{c2s_pid = undefined}}; StateData#state{c2s_pid = undefined}};
handle_sync_event(_Event, _From, StateName, State) -> handle_sync_event(_Event, _From, StateName, State) ->
?ERROR_MSG("unexpected sync event in '~s': ~p", ?ERROR_MSG("Unexpected sync event in '~s': ~p",
[StateName, _Event]), [StateName, _Event]),
{reply, {error, badarg}, StateName, State}. {reply, {error, badarg}, StateName, State}.
@ -584,7 +584,7 @@ handle_info({timeout, TRef, shaper_timeout}, StateName,
_ -> {next_state, StateName, State} _ -> {next_state, StateName, State}
end; end;
handle_info(_Info, StateName, State) -> handle_info(_Info, StateName, State) ->
?ERROR_MSG("unexpected info:~n** Msg: ~p~n** StateName: ~p", ?ERROR_MSG("Unexpected info:~n** Msg: ~p~n** StateName: ~p",
[_Info, StateName]), [_Info, StateName]),
{next_state, StateName, State}. {next_state, StateName, State}.
@ -676,7 +676,7 @@ drop_holding_receiver(State, RID) ->
end. end.
do_reply(State, From, Body, RID) -> do_reply(State, From, Body, RID) ->
?DEBUG("send reply:~n** RequestID: ~p~n** Reply: " ?DEBUG("Send reply:~n** RequestID: ~p~n** Reply: "
"~p~n** To: ~p~n** State: ~p", "~p~n** To: ~p~n** State: ~p",
[RID, Body, From, State]), [RID, Body, From, State]),
p1_fsm:reply(From, Body), p1_fsm:reply(From, Body),
@ -949,7 +949,7 @@ bosh_response(Body, Type) ->
encode_body(Body, Type)}. encode_body(Body, Type)}.
bosh_response_with_msg(Body, Type, RcvBody) -> bosh_response_with_msg(Body, Type, RcvBody) ->
?DEBUG("send error reply:~p~n** Receiced body: ~p", ?DEBUG("Send error reply:~p~n** Receiced body: ~p",
[Body, RcvBody]), [Body, RcvBody]),
bosh_response(Body, Type). bosh_response(Body, Type).

View File

@ -248,11 +248,11 @@ process_info(#{jid := JID} = State, {resend_presence, To}) ->
process_presence_out(State, xmpp:set_to(Pres, To)) process_presence_out(State, xmpp:set_to(Pres, To))
end; end;
process_info(State, Info) -> process_info(State, Info) ->
?WARNING_MSG("got unexpected info: ~p", [Info]), ?WARNING_MSG("Unexpected info: ~p", [Info]),
State. State.
handle_unexpected_cast(State, Msg) -> handle_unexpected_cast(State, Msg) ->
?WARNING_MSG("got unexpected cast: ~p", [Msg]), ?WARNING_MSG("Unexpected cast: ~p", [Msg]),
State. State.
reject_unauthenticated_packet(State, _Pkt) -> reject_unauthenticated_packet(State, _Pkt) ->

View File

@ -345,7 +345,7 @@ handle_call(_Request, _From, State) ->
handle_cast(_Msg, State) -> {noreply, State}. handle_cast(_Msg, State) -> {noreply, State}.
handle_info({remove_id, Id}, State) -> handle_info({remove_id, Id}, State) ->
?DEBUG("captcha ~p timed out", [Id]), ?DEBUG("CAPTCHA ~p timed out", [Id]),
case ets:lookup(captcha, Id) of case ets:lookup(captcha, Id) of
[#captcha{args = Args, pid = Pid}] -> [#captcha{args = Args, pid = Pid}] ->
callback(captcha_failed, Pid, Args), callback(captcha_failed, Pid, Args),

View File

@ -80,7 +80,7 @@ handle_cast({restart_timer, Expire}, State) ->
State1 = State#state{expire = min(Expire, State#state.expire)}, State1 = State#state{expire = min(Expire, State#state.expire)},
noreply(State1); noreply(State1);
handle_cast(Msg, State) -> handle_cast(Msg, State) ->
?WARNING_MSG("unexpected cast: ~p", [Msg]), ?WARNING_MSG("Unexpected cast: ~p", [Msg]),
noreply(State). noreply(State).
handle_info({route, IQ, Key}, State) -> handle_info({route, IQ, Key}, State) ->
@ -96,7 +96,7 @@ handle_info(timeout, State) ->
Expire = clean(ets:first(?MODULE)), Expire = clean(ets:first(?MODULE)),
noreply(State#state{expire = Expire}); noreply(State#state{expire = Expire});
handle_info(Info, State) -> handle_info(Info, State) ->
?WARNING_MSG("unexpected info: ~p", [Info]), ?WARNING_MSG("Unexpected info: ~p", [Info]),
noreply(State). noreply(State).
terminate(_Reason, _State) -> terminate(_Reason, _State) ->

View File

@ -73,7 +73,7 @@ start_link() ->
route(Packet) -> route(Packet) ->
try do_route(Packet) try do_route(Packet)
catch ?EX_RULE(E, R, St) -> catch ?EX_RULE(E, R, St) ->
?ERROR_MSG("failed to route packet:~n~s~nReason = ~p", ?ERROR_MSG("Failed to route packet:~n~s~nReason = ~p",
[xmpp:pp(Packet), {E, {R, ?EX_STACK(St)}}]) [xmpp:pp(Packet), {E, {R, ?EX_STACK(St)}}])
end. end.
@ -123,7 +123,7 @@ handle_info({route, Packet}, State) ->
route(Packet), route(Packet),
{noreply, State}; {noreply, State};
handle_info(Info, State) -> handle_info(Info, State) ->
?WARNING_MSG("unexpected info: ~p", [Info]), ?WARNING_MSG("Unexpected info: ~p", [Info]),
{noreply, State}. {noreply, State}.
terminate(_Reason, _State) -> terminate(_Reason, _State) ->
@ -140,7 +140,7 @@ code_change(_OldVsn, State, _Extra) ->
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
-spec do_route(stanza()) -> any(). -spec do_route(stanza()) -> any().
do_route(Packet) -> do_route(Packet) ->
?DEBUG("local route:~n~s", [xmpp:pp(Packet)]), ?DEBUG("Local route:~n~s", [xmpp:pp(Packet)]),
Type = xmpp:get_type(Packet), Type = xmpp:get_type(Packet),
To = xmpp:get_to(Packet), To = xmpp:get_to(Packet),
if To#jid.luser /= <<"">> -> if To#jid.luser /= <<"">> ->

View File

@ -438,7 +438,7 @@ mnesia_op(Fun, Args) ->
{atomic, ok} -> {atomic, ok} ->
{atomic, ok}; {atomic, ok};
Other -> Other ->
?ERROR_MSG("failure on mnesia ~s ~p: ~p", ?ERROR_MSG("Failure on mnesia ~s ~p: ~p",
[Fun, Args, Other]), [Fun, Args, Other]),
Other Other
end. end.

View File

@ -56,7 +56,7 @@ store(R) ->
{ok, Code, _} when Code == 200 orelse Code == 201 -> {ok, Code, _} when Code == 200 orelse Code == 201 ->
ok; ok;
Err -> Err ->
?ERROR_MSG("failed to store oauth record ~p: ~p", [R, Err]), ?ERROR_MSG("Failed to store oauth record ~p: ~p", [R, Err]),
{error, db_failure} {error, db_failure}
end. end.

View File

@ -390,7 +390,7 @@ handle_call({subscribe, Caller, Channels}, _From,
eredis_subscribe(Pid, Channels), eredis_subscribe(Pid, Channels),
{reply, ok, State#state{subscriptions = Subs1}}; {reply, ok, State#state{subscriptions = Subs1}};
handle_call(Request, _From, State) -> handle_call(Request, _From, State) ->
?WARNING_MSG("unexepected call: ~p", [Request]), ?WARNING_MSG("Unexepected call: ~p", [Request]),
{noreply, State}. {noreply, State}.
handle_cast(_Msg, State) -> handle_cast(_Msg, State) ->
@ -423,7 +423,7 @@ handle_info({subscribed, Channel, Pid}, State) ->
case maps:is_key(Channel, State#state.subscriptions) of case maps:is_key(Channel, State#state.subscriptions) of
true -> eredis_sub:ack_message(Pid); true -> eredis_sub:ack_message(Pid);
false -> false ->
?WARNING_MSG("got subscription ack for unknown channel ~s", ?WARNING_MSG("Got subscription ack for unknown channel ~s",
[Channel]) [Channel])
end; end;
_ -> _ ->
@ -443,7 +443,7 @@ handle_info({message, Channel, Data, Pid}, State) ->
end, end,
{noreply, State}; {noreply, State};
handle_info(Info, State) -> handle_info(Info, State) ->
?WARNING_MSG("unexpected info = ~p", [Info]), ?WARNING_MSG("Unexpected info = ~p", [Info]),
{noreply, State}. {noreply, State}.
terminate(_Reason, _State) -> terminate(_Reason, _State) ->
@ -497,7 +497,7 @@ do_connect(_, Server, Port, Pass, DB, ConnTimeout) ->
(pos_integer(), {qp, redis_pipeline()}, integer()) -> (pos_integer(), {qp, redis_pipeline()}, integer()) ->
[{ok, redis_reply()} | redis_error()] | redis_error(). [{ok, redis_reply()} | redis_error()] | redis_error().
call(I, {F, Cmd}, Retries) -> call(I, {F, Cmd}, Retries) ->
?DEBUG("redis query: ~p", [Cmd]), ?DEBUG("Redis query: ~p", [Cmd]),
Conn = get_connection(I), Conn = get_connection(I),
Res = try eredis:F(Conn, Cmd, ?CALL_TIMEOUT) of Res = try eredis:F(Conn, Cmd, ?CALL_TIMEOUT) of
{error, Reason} when is_atom(Reason) -> {error, Reason} when is_atom(Reason) ->
@ -630,5 +630,5 @@ re_subscribe(Pid, Subs) ->
end. end.
eredis_subscribe(Pid, Channels) -> eredis_subscribe(Pid, Channels) ->
?DEBUG("redis query: ~p", [[<<"SUBSCRIBE">>|Channels]]), ?DEBUG("Redis query: ~p", [[<<"SUBSCRIBE">>|Channels]]),
eredis_sub:subscribe(Pid, Channels). eredis_sub:subscribe(Pid, Channels).

View File

@ -459,7 +459,7 @@ handle_cast(_Msg, State) ->
handle_info({'DOWN', _MonitorRef, _Type, _Object, _Info}, State) -> handle_info({'DOWN', _MonitorRef, _Type, _Object, _Info}, State) ->
{stop, normal, State}; {stop, normal, State};
handle_info(_Info, State) -> handle_info(_Info, State) ->
?ERROR_MSG("unexpected info: ~p", [_Info]), ?ERROR_MSG("Unexpected info: ~p", [_Info]),
{noreply, State}. {noreply, State}.
%% @private %% @private
@ -511,7 +511,7 @@ log_error({error, Why} = Err, Function, Opts) ->
true -> true ->
io_lib:fwrite("** Error: ~p", [Err]) io_lib:fwrite("** Error: ~p", [Err])
end, end,
?ERROR_MSG("database error:~n** Function: ~p~n~s~s", ?ERROR_MSG("Database error:~n** Function: ~p~n~s~s",
[Function, Txt, ErrTxt]); [Function, Txt, ErrTxt]);
log_error(_, _, _) -> log_error(_, _, _) ->
ok. ok.

View File

@ -90,7 +90,7 @@ start_link() ->
route(Packet) -> route(Packet) ->
try do_route(Packet) try do_route(Packet)
catch ?EX_RULE(E, R, St) -> catch ?EX_RULE(E, R, St) ->
?ERROR_MSG("failed to route packet:~n~s~nReason = ~p", ?ERROR_MSG("Failed to route packet:~n~s~nReason = ~p",
[xmpp:pp(Packet), {E, {R, ?EX_STACK(St)}}]) [xmpp:pp(Packet), {E, {R, ?EX_STACK(St)}}])
end. end.
@ -99,7 +99,7 @@ route(#jid{} = From, #jid{} = To, #xmlel{} = El) ->
try xmpp:decode(El, ?NS_CLIENT, [ignore_els]) of try xmpp:decode(El, ?NS_CLIENT, [ignore_els]) of
Pkt -> route(From, To, Pkt) Pkt -> route(From, To, Pkt)
catch _:{xmpp_codec, Why} -> catch _:{xmpp_codec, Why} ->
?ERROR_MSG("failed to decode xml element ~p when " ?ERROR_MSG("Failed to decode xml element ~p when "
"routing from ~s to ~s: ~s", "routing from ~s to ~s: ~s",
[El, jid:encode(From), jid:encode(To), [El, jid:encode(From), jid:encode(To),
xmpp:format_error(Why)]) xmpp:format_error(Why)])
@ -334,7 +334,7 @@ handle_info({route, Packet}, State) ->
route(Packet), route(Packet),
{noreply, State}; {noreply, State};
handle_info(Info, State) -> handle_info(Info, State) ->
?ERROR_MSG("unexpected info: ~p", [Info]), ?ERROR_MSG("Unexpected info: ~p", [Info]),
{noreply, State}. {noreply, State}.
terminate(_Reason, _State) -> terminate(_Reason, _State) ->
@ -348,7 +348,7 @@ code_change(_OldVsn, State, _Extra) ->
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
-spec do_route(stanza()) -> ok. -spec do_route(stanza()) -> ok.
do_route(OrigPacket) -> do_route(OrigPacket) ->
?DEBUG("route:~n~s", [xmpp:pp(OrigPacket)]), ?DEBUG("Route:~n~s", [xmpp:pp(OrigPacket)]),
case ejabberd_hooks:run_fold(filter_packet, OrigPacket, []) of case ejabberd_hooks:run_fold(filter_packet, OrigPacket, []) of
drop -> drop ->
ok; ok;

View File

@ -201,7 +201,7 @@ handle_info({'DOWN', _Ref, _Type, Pid, _Info}, State) ->
transaction(F), transaction(F),
{noreply, State}; {noreply, State};
handle_info(Info, State) -> handle_info(Info, State) ->
?ERROR_MSG("unexpected info: ~p", [Info]), ?ERROR_MSG("Unexpected info: ~p", [Info]),
{noreply, State}. {noreply, State}.
terminate(_Reason, _State) -> terminate(_Reason, _State) ->

View File

@ -209,7 +209,7 @@ code_change(_OldVsn, State, _Extra) ->
%% Destinations = [#jid] %% Destinations = [#jid]
-spec do_route(binary(), [jid()], stanza()) -> any(). -spec do_route(binary(), [jid()], stanza()) -> any().
do_route(Domain, Destinations, Packet) -> do_route(Domain, Destinations, Packet) ->
?DEBUG("route multicast:~n~s~nDomain: ~s~nDestinations: ~s~n", ?DEBUG("Route multicast:~n~s~nDomain: ~s~nDestinations: ~s~n",
[xmpp:pp(Packet), Domain, [xmpp:pp(Packet), Domain,
str:join([jid:encode(To) || To <- Destinations], <<", ">>)]), str:join([jid:encode(To) || To <- Destinations], <<", ">>)]),
%% Try to find an appropriate multicast service %% Try to find an appropriate multicast service

View File

@ -139,7 +139,7 @@ handle_cast(_Msg, State) ->
{noreply, State}. {noreply, State}.
handle_info(Info, State) -> handle_info(Info, State) ->
?ERROR_MSG("unexpected info: ~p", [Info]), ?ERROR_MSG("Unexpected info: ~p", [Info]),
{noreply, State}. {noreply, State}.
terminate(_Reason, _State) -> terminate(_Reason, _State) ->

View File

@ -78,6 +78,6 @@ clean_table() ->
ejabberd_riak:delete(route, {Domain, Pid}) ejabberd_riak:delete(route, {Domain, Pid})
end, Routes); end, Routes);
{error, Err} -> {error, Err} ->
?ERROR_MSG("failed to clean Riak 'route' table: ~p", [Err]), ?ERROR_MSG("Failed to clean Riak 'route' table: ~p", [Err]),
Err Err
end. end.

View File

@ -44,7 +44,7 @@ init() ->
{updated, _} -> {updated, _} ->
ok; ok;
Err -> Err ->
?ERROR_MSG("failed to clean 'route' table: ~p", [Err]), ?ERROR_MSG("Failed to clean 'route' table: ~p", [Err]),
Err Err
end. end.
@ -122,7 +122,7 @@ row_to_route(Domain, {ServerHost, NodeS, PidS, LocalHintS} = Row) ->
catch _:{bad_node, _} -> catch _:{bad_node, _} ->
[]; [];
?EX_RULE(E, R, St) -> ?EX_RULE(E, R, St) ->
?ERROR_MSG("failed to decode row from 'route' table:~n" ?ERROR_MSG("Failed to decode row from 'route' table:~n"
"Row = ~p~n" "Row = ~p~n"
"Domain = ~s~n" "Domain = ~s~n"
"Reason = ~p", "Reason = ~p",

View File

@ -91,7 +91,7 @@ start_link() ->
route(Packet) -> route(Packet) ->
try do_route(Packet) try do_route(Packet)
catch ?EX_RULE(E, R, St) -> catch ?EX_RULE(E, R, St) ->
?ERROR_MSG("failed to route packet:~n~s~nReason = ~p", ?ERROR_MSG("Failed to route packet:~n~s~nReason = ~p",
[xmpp:pp(Packet), {E, {R, ?EX_STACK(St)}}]) [xmpp:pp(Packet), {E, {R, ?EX_STACK(St)}}])
end. end.
@ -348,12 +348,12 @@ clean_table_from_bad_node(Node) ->
-spec do_route(stanza()) -> ok. -spec do_route(stanza()) -> ok.
do_route(Packet) -> do_route(Packet) ->
?DEBUG("local route:~n~s", [xmpp:pp(Packet)]), ?DEBUG("Local route:~n~s", [xmpp:pp(Packet)]),
From = xmpp:get_from(Packet), From = xmpp:get_from(Packet),
To = xmpp:get_to(Packet), To = xmpp:get_to(Packet),
case start_connection(From, To) of case start_connection(From, To) of
{ok, Pid} when is_pid(Pid) -> {ok, Pid} when is_pid(Pid) ->
?DEBUG("sending to process ~p~n", [Pid]), ?DEBUG("Sending to process ~p~n", [Pid]),
#jid{lserver = MyServer} = From, #jid{lserver = MyServer} = From,
ejabberd_hooks:run(s2s_send_packet, MyServer, [Packet]), ejabberd_hooks:run(s2s_send_packet, MyServer, [Packet]),
ejabberd_s2s_out:route(Pid, Packet); ejabberd_s2s_out:route(Pid, Packet);
@ -484,7 +484,7 @@ new_connection(MyServer, Server, From, FromTo,
end, end,
[Pid1]; [Pid1];
{aborted, Reason} -> {aborted, Reason} ->
?ERROR_MSG("failed to register connection ~s -> ~s: ~p", ?ERROR_MSG("Failed to register connection ~s -> ~s: ~p",
[MyServer, Server, Reason]), [MyServer, Server, Reason]),
ejabberd_s2s_out:stop(Pid), ejabberd_s2s_out:stop(Pid),
[] []

View File

@ -112,11 +112,11 @@ host_down(Host) ->
%%% Hooks %%% Hooks
%%%=================================================================== %%%===================================================================
handle_unexpected_info(State, Info) -> handle_unexpected_info(State, Info) ->
?WARNING_MSG("got unexpected info: ~p", [Info]), ?WARNING_MSG("Unexpected info: ~p", [Info]),
State. State.
handle_unexpected_cast(State, Msg) -> handle_unexpected_cast(State, Msg) ->
?WARNING_MSG("got unexpected cast: ~p", [Msg]), ?WARNING_MSG("Unexpected cast: ~p", [Msg]),
State. State.
reject_unauthenticated_packet(State, _Pkt) -> reject_unauthenticated_packet(State, _Pkt) ->

View File

@ -164,11 +164,11 @@ process_closed(#{server := LServer, remote_server := RServer} = State,
xmpp_stream_out:set_timeout(State2, timer:seconds(Delay)). xmpp_stream_out:set_timeout(State2, timer:seconds(Delay)).
handle_unexpected_info(State, Info) -> handle_unexpected_info(State, Info) ->
?WARNING_MSG("got unexpected info: ~p", [Info]), ?WARNING_MSG("Unexpected info: ~p", [Info]),
State. State.
handle_unexpected_cast(State, Msg) -> handle_unexpected_cast(State, Msg) ->
?WARNING_MSG("got unexpected cast: ~p", [Msg]), ?WARNING_MSG("Unexpected cast: ~p", [Msg]),
State. State.
process_downgraded(State, _StreamStart) -> process_downgraded(State, _StreamStart) ->

View File

@ -126,7 +126,7 @@ stop() ->
route(To, Term) -> route(To, Term) ->
case catch do_route(To, Term) of case catch do_route(To, Term) of
{'EXIT', Reason} -> {'EXIT', Reason} ->
?ERROR_MSG("route ~p to ~p failed: ~p", ?ERROR_MSG("Route ~p to ~p failed: ~p",
[Term, To, Reason]); [Term, To, Reason]);
_ -> _ ->
ok ok
@ -137,11 +137,11 @@ route(Packet) ->
#jid{lserver = LServer} = xmpp:get_to(Packet), #jid{lserver = LServer} = xmpp:get_to(Packet),
case ejabberd_hooks:run_fold(sm_receive_packet, LServer, Packet, []) of case ejabberd_hooks:run_fold(sm_receive_packet, LServer, Packet, []) of
drop -> drop ->
?DEBUG("hook dropped stanza:~n~s", [xmpp:pp(Packet)]); ?DEBUG("Hook dropped stanza:~n~s", [xmpp:pp(Packet)]);
Packet1 -> Packet1 ->
try do_route(Packet1), ok try do_route(Packet1), ok
catch ?EX_RULE(E, R, St) -> catch ?EX_RULE(E, R, St) ->
?ERROR_MSG("failed to route packet:~n~s~nReason = ~p", ?ERROR_MSG("Failed to route packet:~n~s~nReason = ~p",
[xmpp:pp(Packet1), [xmpp:pp(Packet1),
{E, {R, ?EX_STACK(St)}}]) {E, {R, ?EX_STACK(St)}}])
end end
@ -204,7 +204,7 @@ bounce_sm_packet({bounce, Packet} = Acc) ->
ejabberd_router:route_error(Packet, Err), ejabberd_router:route_error(Packet, Err),
{stop, Acc}; {stop, Acc};
bounce_sm_packet({_, Packet} = Acc) -> bounce_sm_packet({_, Packet} = Acc) ->
?DEBUG("dropping packet to unavailable resource:~n~s", ?DEBUG("Dropping packet to unavailable resource:~n~s",
[xmpp:pp(Packet)]), [xmpp:pp(Packet)]),
Acc. Acc.
@ -491,7 +491,7 @@ handle_info({route, Packet}, State) ->
route(Packet), route(Packet),
{noreply, State}; {noreply, State};
handle_info(Info, State) -> handle_info(Info, State) ->
?WARNING_MSG("unexpected info: ~p", [Info]), ?WARNING_MSG("Unexpected info: ~p", [Info]),
{noreply, State}. {noreply, State}.
terminate(_Reason, _State) -> terminate(_Reason, _State) ->
@ -633,23 +633,23 @@ do_route(#jid{lresource = <<"">>} = To, Term) ->
do_route(jid:replace_resource(To, R), Term) do_route(jid:replace_resource(To, R), Term)
end, get_user_resources(To#jid.user, To#jid.server)); end, get_user_resources(To#jid.user, To#jid.server));
do_route(To, Term) -> do_route(To, Term) ->
?DEBUG("broadcasting ~p to ~s", [Term, jid:encode(To)]), ?DEBUG("Broadcasting ~p to ~s", [Term, jid:encode(To)]),
{U, S, R} = jid:tolower(To), {U, S, R} = jid:tolower(To),
Mod = get_sm_backend(S), Mod = get_sm_backend(S),
case get_sessions(Mod, U, S, R) of case get_sessions(Mod, U, S, R) of
[] -> [] ->
?DEBUG("dropping broadcast to unavailable resourse: ~p", [Term]); ?DEBUG("Dropping broadcast to unavailable resourse: ~p", [Term]);
Ss -> Ss ->
Session = lists:max(Ss), Session = lists:max(Ss),
Pid = element(2, Session#session.sid), Pid = element(2, Session#session.sid),
?DEBUG("sending to process ~p: ~p", [Pid, Term]), ?DEBUG("Sending to process ~p: ~p", [Pid, Term]),
ejabberd_c2s:route(Pid, Term) ejabberd_c2s:route(Pid, Term)
end. end.
-spec do_route(stanza()) -> any(). -spec do_route(stanza()) -> any().
do_route(#presence{to = To, type = T} = Packet) do_route(#presence{to = To, type = T} = Packet)
when T == subscribe; T == subscribed; T == unsubscribe; T == unsubscribed -> when T == subscribe; T == subscribed; T == unsubscribe; T == unsubscribed ->
?DEBUG("processing subscription:~n~s", [xmpp:pp(Packet)]), ?DEBUG("Processing subscription:~n~s", [xmpp:pp(Packet)]),
#jid{luser = LUser, lserver = LServer} = To, #jid{luser = LUser, lserver = LServer} = To,
case is_privacy_allow(Packet) andalso case is_privacy_allow(Packet) andalso
ejabberd_hooks:run_fold( ejabberd_hooks:run_fold(
@ -662,7 +662,7 @@ do_route(#presence{to = To, type = T} = Packet)
priority = Prio}) when is_integer(Prio) -> priority = Prio}) when is_integer(Prio) ->
Pid = element(2, SID), Pid = element(2, SID),
Packet1 = Packet#presence{to = jid:replace_resource(To, R)}, Packet1 = Packet#presence{to = jid:replace_resource(To, R)},
?DEBUG("sending to process ~p:~n~s", ?DEBUG("Sending to process ~p:~n~s",
[Pid, xmpp:pp(Packet1)]), [Pid, xmpp:pp(Packet1)]),
ejabberd_c2s:route(Pid, {route, Packet1}); ejabberd_c2s:route(Pid, {route, Packet1});
(_) -> (_) ->
@ -672,14 +672,14 @@ do_route(#presence{to = To, type = T} = Packet)
ok ok
end; end;
do_route(#presence{to = #jid{lresource = <<"">>} = To} = Packet) -> do_route(#presence{to = #jid{lresource = <<"">>} = To} = Packet) ->
?DEBUG("processing presence to bare JID:~n~s", [xmpp:pp(Packet)]), ?DEBUG("Processing presence to bare JID:~n~s", [xmpp:pp(Packet)]),
{LUser, LServer, _} = jid:tolower(To), {LUser, LServer, _} = jid:tolower(To),
lists:foreach( lists:foreach(
fun({_, R}) -> fun({_, R}) ->
do_route(Packet#presence{to = jid:replace_resource(To, R)}) do_route(Packet#presence{to = jid:replace_resource(To, R)})
end, get_user_present_resources(LUser, LServer)); end, get_user_present_resources(LUser, LServer));
do_route(#message{to = #jid{lresource = <<"">>} = To, type = T} = Packet) -> do_route(#message{to = #jid{lresource = <<"">>} = To, type = T} = Packet) ->
?DEBUG("processing message to bare JID:~n~s", [xmpp:pp(Packet)]), ?DEBUG("Processing message to bare JID:~n~s", [xmpp:pp(Packet)]),
if T == chat; T == headline; T == normal -> if T == chat; T == headline; T == normal ->
route_message(Packet); route_message(Packet);
true -> true ->
@ -688,14 +688,14 @@ do_route(#message{to = #jid{lresource = <<"">>} = To, type = T} = Packet) ->
end; end;
do_route(#iq{to = #jid{lresource = <<"">>} = To, type = T} = Packet) -> do_route(#iq{to = #jid{lresource = <<"">>} = To, type = T} = Packet) ->
if T == set; T == get -> if T == set; T == get ->
?DEBUG("processing IQ to bare JID:~n~s", [xmpp:pp(Packet)]), ?DEBUG("Processing IQ to bare JID:~n~s", [xmpp:pp(Packet)]),
gen_iq_handler:handle(?MODULE, Packet); gen_iq_handler:handle(?MODULE, Packet);
true -> true ->
ejabberd_hooks:run_fold(bounce_sm_packet, ejabberd_hooks:run_fold(bounce_sm_packet,
To#jid.lserver, {pass, Packet}, []) To#jid.lserver, {pass, Packet}, [])
end; end;
do_route(Packet) -> do_route(Packet) ->
?DEBUG("processing packet to full JID:~n~s", [xmpp:pp(Packet)]), ?DEBUG("Processing packet to full JID:~n~s", [xmpp:pp(Packet)]),
To = xmpp:get_to(Packet), To = xmpp:get_to(Packet),
{LUser, LServer, LResource} = jid:tolower(To), {LUser, LServer, LResource} = jid:tolower(To),
Mod = get_sm_backend(LServer), Mod = get_sm_backend(LServer),
@ -717,7 +717,7 @@ do_route(Packet) ->
Ss -> Ss ->
Session = lists:max(Ss), Session = lists:max(Ss),
Pid = element(2, Session#session.sid), Pid = element(2, Session#session.sid),
?DEBUG("sending to process ~p:~n~s", [Pid, xmpp:pp(Packet)]), ?DEBUG("Sending to process ~p:~n~s", [Pid, xmpp:pp(Packet)]),
ejabberd_c2s:route(Pid, {route, Packet}) ejabberd_c2s:route(Pid, {route, Packet})
end. end.
@ -752,7 +752,7 @@ route_message(#message{to = To, type = Type} = Packet) ->
Ss -> Ss ->
Session = lists:max(Ss), Session = lists:max(Ss),
Pid = element(2, Session#session.sid), Pid = element(2, Session#session.sid),
?DEBUG("sending to process ~p~n", [Pid]), ?DEBUG("Sending to process ~p~n", [Pid]),
LMaxRes = jid:resourceprep(MaxRes), LMaxRes = jid:resourceprep(MaxRes),
Packet1 = maybe_mark_as_copy(Packet, Packet1 = maybe_mark_as_copy(Packet,
LResource, LResource,

View File

@ -160,11 +160,11 @@ handle_info({redis_message, ?SM_KEY, Data}, State) ->
{delete, Key} -> {delete, Key} ->
ets_cache:delete(?SM_CACHE, Key); ets_cache:delete(?SM_CACHE, Key);
Msg -> Msg ->
?WARNING_MSG("unexpected redis message: ~p", [Msg]) ?WARNING_MSG("Unexpected redis message: ~p", [Msg])
end, end,
{noreply, State}; {noreply, State};
handle_info(Info, State) -> handle_info(Info, State) ->
?ERROR_MSG("unexpected info: ~p", [Info]), ?ERROR_MSG("Unexpected info: ~p", [Info]),
{noreply, State}. {noreply, State}.
terminate(_Reason, _State) -> terminate(_Reason, _State) ->

View File

@ -53,7 +53,7 @@ init() ->
{updated, _} -> {updated, _} ->
ok; ok;
Err -> Err ->
?ERROR_MSG("failed to clean 'sm' table: ~p", [Err]), ?ERROR_MSG("Failed to clean 'sm' table: ~p", [Err]),
{error, db_failure} {error, db_failure}
end; end;
(_, Err) -> (_, Err) ->

View File

@ -169,7 +169,7 @@ keep_alive(Host, PID) ->
{selected,_,[[<<"1">>]]} -> {selected,_,[[<<"1">>]]} ->
ok; ok;
_Err -> _Err ->
?ERROR_MSG("keep alive query failed, closing connection: ~p", [_Err]), ?ERROR_MSG("Keep alive query failed, closing connection: ~p", [_Err]),
sync_send_event(PID, force_timeout, query_timeout(Host)) sync_send_event(PID, force_timeout, query_timeout(Host))
end. end.
@ -364,7 +364,7 @@ connecting(connect, #state{host = Host} = State) ->
{next_state, connecting, State} {next_state, connecting, State}
end; end;
connecting(Event, State) -> connecting(Event, State) ->
?WARNING_MSG("unexpected event in 'connecting': ~p", ?WARNING_MSG("Unexpected event in 'connecting': ~p",
[Event]), [Event]),
{next_state, connecting, State}. {next_state, connecting, State}.
@ -376,7 +376,7 @@ connecting({sql_cmd, {sql_query, ?KEEPALIVE_QUERY},
{next_state, connecting, State}; {next_state, connecting, State};
connecting({sql_cmd, Command, Timestamp} = Req, From, connecting({sql_cmd, Command, Timestamp} = Req, From,
State) -> State) ->
?DEBUG("queuing pending request while connecting:~n\t~p", ?DEBUG("Queuing pending request while connecting:~n\t~p",
[Req]), [Req]),
PendingRequests = PendingRequests =
try p1_queue:in({sql_cmd, Command, From, Timestamp}, try p1_queue:in({sql_cmd, Command, From, Timestamp},
@ -393,7 +393,7 @@ connecting({sql_cmd, Command, Timestamp} = Req, From,
{next_state, connecting, {next_state, connecting,
State#state{pending_requests = PendingRequests}}; State#state{pending_requests = PendingRequests}};
connecting(Request, {Who, _Ref}, State) -> connecting(Request, {Who, _Ref}, State) ->
?WARNING_MSG("unexpected call ~p from ~p in 'connecting'", ?WARNING_MSG("Unexpected call ~p from ~p in 'connecting'",
[Request, Who]), [Request, Who]),
{reply, {error, badarg}, connecting, State}. {reply, {error, badarg}, connecting, State}.
@ -401,7 +401,7 @@ session_established({sql_cmd, Command, Timestamp}, From,
State) -> State) ->
run_sql_cmd(Command, From, State, Timestamp); run_sql_cmd(Command, From, State, Timestamp);
session_established(Request, {Who, _Ref}, State) -> session_established(Request, {Who, _Ref}, State) ->
?WARNING_MSG("unexpected call ~p from ~p in 'session_establ" ?WARNING_MSG("Unexpected call ~p from ~p in 'session_establ"
"ished'", "ished'",
[Request, Who]), [Request, Who]),
{reply, {error, badarg}, session_established, State}. {reply, {error, badarg}, session_established, State}.
@ -412,7 +412,7 @@ session_established({sql_cmd, Command, From, Timestamp},
session_established(force_timeout, State) -> session_established(force_timeout, State) ->
{stop, timeout, State}; {stop, timeout, State};
session_established(Event, State) -> session_established(Event, State) ->
?WARNING_MSG("unexpected event in 'session_established': ~p", ?WARNING_MSG("Unexpected event in 'session_established': ~p",
[Event]), [Event]),
{next_state, session_established, State}. {next_state, session_established, State}.
@ -432,7 +432,7 @@ handle_info({'DOWN', _MonitorRef, process, _Pid, _Info},
p1_fsm:send_event(self(), connect), p1_fsm:send_event(self(), connect),
{next_state, connecting, State}; {next_state, connecting, State};
handle_info(Info, StateName, State) -> handle_info(Info, StateName, State) ->
?WARNING_MSG("unexpected info in ~p: ~p", ?WARNING_MSG("Unexpected info in ~p: ~p",
[StateName, Info]), [StateName, Info]),
{next_state, StateName, State}. {next_state, StateName, State}.
@ -496,7 +496,7 @@ inner_transaction(F) ->
case get(?NESTING_KEY) of case get(?NESTING_KEY) of
?TOP_LEVEL_TXN -> ?TOP_LEVEL_TXN ->
{backtrace, T} = process_info(self(), backtrace), {backtrace, T} = process_info(self(), backtrace),
?ERROR_MSG("inner transaction called at outer txn " ?ERROR_MSG("Inner transaction called at outer txn "
"level. Trace: ~s", "level. Trace: ~s",
[T]), [T]),
erlang:exit(implementation_faulty); erlang:exit(implementation_faulty);
@ -518,7 +518,7 @@ outer_transaction(F, NRestarts, _Reason) ->
?TOP_LEVEL_TXN -> ok; ?TOP_LEVEL_TXN -> ok;
_N -> _N ->
{backtrace, T} = process_info(self(), backtrace), {backtrace, T} = process_info(self(), backtrace),
?ERROR_MSG("outer transaction called at inner txn " ?ERROR_MSG("Outer transaction called at inner txn "
"level. Trace: ~s", "level. Trace: ~s",
[T]), [T]),
erlang:exit(implementation_faulty) erlang:exit(implementation_faulty)
@ -965,11 +965,11 @@ get_db_version(#state{db_type = pgsql} = State) ->
Version when is_integer(Version) -> Version when is_integer(Version) ->
State#state{db_version = Version}; State#state{db_version = Version};
Error -> Error ->
?WARNING_MSG("error getting pgsql version: ~p", [Error]), ?WARNING_MSG("Error getting pgsql version: ~p", [Error]),
State State
end; end;
Res -> Res ->
?WARNING_MSG("error getting pgsql version: ~p", [Res]), ?WARNING_MSG("Error getting pgsql version: ~p", [Res]),
State State
end; end;
get_db_version(State) -> get_db_version(State) ->
@ -1092,12 +1092,12 @@ init_mssql(Host) ->
os:putenv("FREETDSCONF", freetds_config()), os:putenv("FREETDSCONF", freetds_config()),
ok ok
catch error:{badmatch, {error, Reason} = Err} -> catch error:{badmatch, {error, Reason} = Err} ->
?ERROR_MSG("failed to create temporary files in ~s: ~s", ?ERROR_MSG("Failed to create temporary files in ~s: ~s",
[tmp_dir(), file:format_error(Reason)]), [tmp_dir(), file:format_error(Reason)]),
Err Err
end; end;
{error, Reason} = Err -> {error, Reason} = Err ->
?ERROR_MSG("failed to create temporary directory ~s: ~s", ?ERROR_MSG("Failed to create temporary directory ~s: ~s",
[tmp_dir(), file:format_error(Reason)]), [tmp_dir(), file:format_error(Reason)]),
Err Err
end. end.

View File

@ -118,7 +118,7 @@ remove_pid(Host, Pid) ->
get_pool_size(SQLType, Host) -> get_pool_size(SQLType, Host) ->
PoolSize = ejabberd_option:sql_pool_size(Host), PoolSize = ejabberd_option:sql_pool_size(Host),
if PoolSize > 1 andalso SQLType == sqlite -> if PoolSize > 1 andalso SQLType == sqlite ->
?WARNING_MSG("it's not recommended to set sql_pool_size > 1 for " ?WARNING_MSG("It's not recommended to set sql_pool_size > 1 for "
"sqlite, because it may cause race conditions", []); "sqlite, because it may cause race conditions", []);
true -> true ->
ok ok

View File

@ -43,7 +43,7 @@ update() ->
eval_script( eval_script(
LowLevelScript, [], LowLevelScript, [],
[{ejabberd, "", filename:join(Dir, "..")}]), [{ejabberd, "", filename:join(Dir, "..")}]),
?DEBUG("eval: ~p~n", [Eval]), ?DEBUG("Eval: ~p~n", [Eval]),
Eval; Eval;
{error, Reason} -> {error, Reason} ->
{error, Reason} {error, Reason}
@ -60,7 +60,7 @@ update(ModulesToUpdate) ->
eval_script( eval_script(
LowLevelScript, [], LowLevelScript, [],
[{ejabberd, "", filename:join(Dir, "..")}]), [{ejabberd, "", filename:join(Dir, "..")}]),
?DEBUG("eval: ~p~n", [Eval]), ?DEBUG("Eval: ~p~n", [Eval]),
Eval; Eval;
{error, Reason} -> {error, Reason} ->
{error, Reason} {error, Reason}
@ -86,7 +86,7 @@ update_info() ->
update_info(Dir, Files) -> update_info(Dir, Files) ->
Beams = lists:sort(get_beams(Files)), Beams = lists:sort(get_beams(Files)),
UpdatedBeams = get_updated_beams(Beams), UpdatedBeams = get_updated_beams(Beams),
?DEBUG("beam files: ~p~n", [UpdatedBeams]), ?DEBUG("BEAM files: ~p~n", [UpdatedBeams]),
{Script, LowLevelScript, Check} = build_script(Dir, UpdatedBeams), {Script, LowLevelScript, Check} = build_script(Dir, UpdatedBeams),
{ok, Dir, UpdatedBeams, Script, LowLevelScript, Check}. {ok, Dir, UpdatedBeams, Script, LowLevelScript, Check}.
@ -135,46 +135,46 @@ build_script(Dir, UpdatedBeams) ->
[{ejabberd, "", filename:join(Dir, "..")}]), [{ejabberd, "", filename:join(Dir, "..")}]),
Check1 = case Check of Check1 = case Check of
{ok, []} -> {ok, []} ->
?DEBUG("script: ~p~n", [Script]), ?DEBUG("Script: ~p~n", [Script]),
?DEBUG("low level script: ~p~n", [LowLevelScript]), ?DEBUG("Low level script: ~p~n", [LowLevelScript]),
?DEBUG("check: ~p~n", [Check]), ?DEBUG("Check: ~p~n", [Check]),
ok; ok;
_ -> _ ->
?ERROR_MSG("script: ~p~n", [Script]), ?ERROR_MSG("Script: ~p~n", [Script]),
?ERROR_MSG("low level script: ~p~n", [LowLevelScript]), ?ERROR_MSG("Low level script: ~p~n", [LowLevelScript]),
?ERROR_MSG("check: ~p~n", [Check]), ?ERROR_MSG("Check: ~p~n", [Check]),
error error
end, end,
{Script, LowLevelScript, Check1}. {Script, LowLevelScript, Check1}.
%% Copied from Erlang/OTP file: lib/sasl/src/systools.hrl %% Copied from Erlang/OTP file: lib/sasl/src/systools.hrl
-record(application, -record(application,
{name, %% Name of the application, atom(). {name, %% Name of the application, atom().
type = permanent, %% Application start type, atom(). type = permanent, %% Application start type, atom().
vsn = "", %% Version of the application, string(). vsn = "", %% Version of the application, string().
id = "", %% Id of the application, string(). id = "", %% Id of the application, string().
description = "", %% Description of application, string(). description = "", %% Description of application, string().
modules = [], %% [Module | {Module,Vsn}] of modules modules = [], %% [Module | {Module,Vsn}] of modules
%% incorporated in the application, %% incorporated in the application,
%% Module = atom(), Vsn = string(). %% Module = atom(), Vsn = string().
uses = [], %% [Application] list of applications required uses = [], %% [Application] list of applications required
%% by the application, Application = atom(). %% by the application, Application = atom().
includes = [], %% [Application] list of applications included includes = [], %% [Application] list of applications included
%% by the application, Application = atom(). %% by the application, Application = atom().
regs = [], %% [RegNames] a list of registered process regs = [], %% [RegNames] a list of registered process
%% names used by the application, RegNames = %% names used by the application, RegNames =
%% atom(). %% atom().
env = [], %% [{Key,Value}] environment variable of env = [], %% [{Key,Value}] environment variable of
%% application, Key = Value = term(). %% application, Key = Value = term().
maxT = infinity, %% Max time an application may exist, maxT = infinity, %% Max time an application may exist,
%% integer() | infinity. %% integer() | infinity.
maxP = infinity, %% Max number of processes in an application, maxP = infinity, %% Max number of processes in an application,
%% integer() | infinity. %% integer() | infinity.
mod = [], %% [] | {Mod, StartArgs}, Mod= atom(), mod = [], %% [] | {Mod, StartArgs}, Mod= atom(),
%% StartArgs = list(). %% StartArgs = list().
start_phases = [], %% [] | {Phase, PhaseArgs}, Phase = atom(), start_phases = [], %% [] | {Phase, PhaseArgs}, Phase = atom(),
%% PhaseArgs = list(). %% PhaseArgs = list().
dir = "" %% The directory where the .app file was dir = "" %% The directory where the .app file was
%% found (internal use). %% found (internal use).
}). }).

View File

@ -463,7 +463,7 @@ process_admin(Host, #request{path = [<<"online-users">>],
process_admin(Host, #request{path = [<<"last-activity">>], process_admin(Host, #request{path = [<<"last-activity">>],
q = Query, lang = Lang}, AJID) q = Query, lang = Lang}, AJID)
when is_binary(Host) -> when is_binary(Host) ->
?DEBUG("query: ~p", [Query]), ?DEBUG("Query: ~p", [Query]),
Month = case lists:keysearch(<<"period">>, 1, Query) of Month = case lists:keysearch(<<"period">>, 1, Query) of
{value, {_, Val}} -> Val; {value, {_, Val}} -> Val;
_ -> <<"month">> _ -> <<"month">>

View File

@ -192,7 +192,7 @@ ws_loop(FrameInfo, Socket, WsHandleLoopPid, SocketMode) ->
{DataType, _Socket, Data} when DataType =:= tcp orelse DataType =:= raw -> {DataType, _Socket, Data} when DataType =:= tcp orelse DataType =:= raw ->
case handle_data(DataType, FrameInfo, Data, Socket, WsHandleLoopPid, SocketMode) of case handle_data(DataType, FrameInfo, Data, Socket, WsHandleLoopPid, SocketMode) of
{error, Error} -> {error, Error} ->
?DEBUG("tls decode error ~p", [Error]), ?DEBUG("TLS decode error ~p", [Error]),
websocket_close(Socket, WsHandleLoopPid, SocketMode, 1002); % protocol error websocket_close(Socket, WsHandleLoopPid, SocketMode, 1002); % protocol error
{NewFrameInfo, ToSend} -> {NewFrameInfo, ToSend} ->
lists:foreach(fun(Pkt) -> SocketMode:send(Socket, Pkt) lists:foreach(fun(Pkt) -> SocketMode:send(Socket, Pkt)
@ -200,17 +200,17 @@ ws_loop(FrameInfo, Socket, WsHandleLoopPid, SocketMode) ->
ws_loop(NewFrameInfo, Socket, WsHandleLoopPid, SocketMode) ws_loop(NewFrameInfo, Socket, WsHandleLoopPid, SocketMode)
end; end;
{tcp_closed, _Socket} -> {tcp_closed, _Socket} ->
?DEBUG("tcp connection was closed, exit", []), ?DEBUG("TCP connection was closed, exit", []),
websocket_close(Socket, WsHandleLoopPid, SocketMode, 0); websocket_close(Socket, WsHandleLoopPid, SocketMode, 0);
{tcp_error, Socket, Reason} -> {tcp_error, Socket, Reason} ->
?DEBUG("tcp connection error: ~s", [inet:format_error(Reason)]), ?DEBUG("TCP connection error: ~s", [inet:format_error(Reason)]),
websocket_close(Socket, WsHandleLoopPid, SocketMode, 0); websocket_close(Socket, WsHandleLoopPid, SocketMode, 0);
{'DOWN', Ref, process, WsHandleLoopPid, Reason} -> {'DOWN', Ref, process, WsHandleLoopPid, Reason} ->
Code = case Reason of Code = case Reason of
normal -> normal ->
1000; % normal close 1000; % normal close
_ -> _ ->
?ERROR_MSG("linked websocket controlling loop crashed " ?ERROR_MSG("Linked websocket controlling loop crashed "
"with reason: ~p", "with reason: ~p",
[Reason]), [Reason]),
1011 % internal error 1011 % internal error
@ -230,12 +230,12 @@ ws_loop(FrameInfo, Socket, WsHandleLoopPid, SocketMode) ->
ws_loop(FrameInfo, Socket, WsHandleLoopPid, ws_loop(FrameInfo, Socket, WsHandleLoopPid,
SocketMode); SocketMode);
shutdown -> shutdown ->
?DEBUG("shutdown request received, closing websocket " ?DEBUG("Shutdown request received, closing websocket "
"with pid ~p", "with pid ~p",
[self()]), [self()]),
websocket_close(Socket, WsHandleLoopPid, SocketMode, 1001); % going away websocket_close(Socket, WsHandleLoopPid, SocketMode, 1001); % going away
_Ignored -> _Ignored ->
?WARNING_MSG("received unexpected message, ignoring: ~p", ?WARNING_MSG("Received unexpected message, ignoring: ~p",
[_Ignored]), [_Ignored]),
ws_loop(FrameInfo, Socket, WsHandleLoopPid, ws_loop(FrameInfo, Socket, WsHandleLoopPid,
SocketMode) SocketMode)

View File

@ -220,7 +220,7 @@ process(_, #request{method = 'POST', data = Data, opts = Opts, ip = {IP, _}}) ->
#xmlel{name = <<"h1">>, attrs = [], #xmlel{name = <<"h1">>, attrs = [],
children = [{xmlcdata, <<"Malformed Request">>}]}}; children = [{xmlcdata, <<"Malformed Request">>}]}};
{ok, RPC} -> {ok, RPC} ->
?DEBUG("got XML-RPC request: ~p", [RPC]), ?DEBUG("Got XML-RPC request: ~p", [RPC]),
{false, Result} = handler(State, RPC), {false, Result} = handler(State, RPC),
XML = fxml:element_to_binary(fxmlrpc:encode(Result)), XML = fxml:element_to_binary(fxmlrpc:encode(Result)),
{200, [{<<"Content-Type">>, <<"text/xml">>}], {200, [{<<"Content-Type">>, <<"text/xml">>}],
@ -486,7 +486,7 @@ format_arg(Arg, string) when is_binary(Arg) -> binary_to_list(Arg);
format_arg(undefined, binary) -> <<>>; format_arg(undefined, binary) -> <<>>;
format_arg(undefined, string) -> ""; format_arg(undefined, string) -> "";
format_arg(Arg, Format) -> format_arg(Arg, Format) ->
?ERROR_MSG("don't know how to format Arg ~p for format ~p", [Arg, Format]), ?ERROR_MSG("Don't know how to format Arg ~p for format ~p", [Arg, Format]),
exit({invalid_arg_type, Arg, Format}). exit({invalid_arg_type, Arg, Format}).
process_unicode_codepoints(Str) -> process_unicode_codepoints(Str) ->

View File

@ -114,7 +114,7 @@ delete(Server, Module) ->
import(Server, Dir, ToType) -> import(Server, Dir, ToType) ->
lists:foreach( lists:foreach(
fun(Mod) -> fun(Mod) ->
?INFO_MSG("importing ~p...", [Mod]), ?INFO_MSG("Importing ~p...", [Mod]),
import(Mod, Server, Dir, ToType) import(Mod, Server, Dir, ToType)
end, modules()). end, modules()).

View File

@ -6,7 +6,7 @@
%%% draft-ietf-asid-ldap-c-api-00.txt %%% draft-ietf-asid-ldap-c-api-00.txt
%%% %%%
%%% Copyright (C) 2000 Torbjorn Tornkvist, tnt@home.se %%% Copyright (C) 2000 Torbjorn Tornkvist, tnt@home.se
%%% %%%
%%% %%%
%%% This program is free software; you can redistribute it and/or modify %%% This program is free software; you can redistribute it and/or modify
%%% it under the terms of the GNU General Public License as published by %%% it under the terms of the GNU General Public License as published by
@ -181,7 +181,7 @@ close(Handle) ->
%%% to succeed. The parent of the entry MUST exist. %%% to succeed. The parent of the entry MUST exist.
%%% Example: %%% Example:
%%% %%%
%%% add(Handle, %%% add(Handle,
%%% "cn=Bill Valentine, ou=people, o=Bluetail AB, dc=bluetail, dc=com", %%% "cn=Bill Valentine, ou=people, o=Bluetail AB, dc=bluetail, dc=com",
%%% [{"objectclass", ["person"]}, %%% [{"objectclass", ["person"]},
%%% {"cn", ["Bill Valentine"]}, %%% {"cn", ["Bill Valentine"]},
@ -205,11 +205,11 @@ add_attrs(Attrs) ->
end. end.
%%% -------------------------------------------------------------------- %%% --------------------------------------------------------------------
%%% Delete an entry. The entry consists of the DN of %%% Delete an entry. The entry consists of the DN of
%%% the entry to be deleted. %%% the entry to be deleted.
%%% Example: %%% Example:
%%% %%%
%%% delete(Handle, %%% delete(Handle,
%%% "cn=Bill Valentine, ou=people, o=Bluetail AB, dc=bluetail, dc=com" %%% "cn=Bill Valentine, ou=people, o=Bluetail AB, dc=bluetail, dc=com"
%%% ) %%% )
%%% -------------------------------------------------------------------- %%% --------------------------------------------------------------------
@ -223,10 +223,10 @@ delete(Handle, Entry) ->
%%% operations can be performed as one atomic operation. %%% operations can be performed as one atomic operation.
%%% Example: %%% Example:
%%% %%%
%%% modify(Handle, %%% modify(Handle,
%%% "cn=Torbjorn Tornkvist, ou=people, o=Bluetail AB, dc=bluetail, dc=com", %%% "cn=Torbjorn Tornkvist, ou=people, o=Bluetail AB, dc=bluetail, dc=com",
%%% [replace("telephoneNumber", ["555 555 00"]), %%% [replace("telephoneNumber", ["555 555 00"]),
%%% add("description", ["LDAP hacker"])] %%% add("description", ["LDAP hacker"])]
%%% ) %%% )
%%% -------------------------------------------------------------------- %%% --------------------------------------------------------------------
-spec modify(handle(), any(), [add | delete | replace]) -> any(). -spec modify(handle(), any(), [add | delete | replace]) -> any().
@ -237,7 +237,7 @@ modify(Handle, Object, Mods) ->
?CALL_TIMEOUT). ?CALL_TIMEOUT).
%%% %%%
%%% Modification operations. %%% Modification operations.
%%% Example: %%% Example:
%%% replace("telephoneNumber", ["555 555 00"]) %%% replace("telephoneNumber", ["555 555 00"])
%%% %%%
@ -252,7 +252,7 @@ mod_delete(Type, Values) ->
%%% operations can be performed as one atomic operation. %%% operations can be performed as one atomic operation.
%%% Example: %%% Example:
%%% %%%
%%% modify_dn(Handle, %%% modify_dn(Handle,
%%% "cn=Bill Valentine, ou=people, o=Bluetail AB, dc=bluetail, dc=com", %%% "cn=Bill Valentine, ou=people, o=Bluetail AB, dc=bluetail, dc=com",
%%% "cn=Ben Emerson", %%% "cn=Ben Emerson",
%%% true, %%% true,
@ -289,12 +289,12 @@ modify_passwd(Handle, DN, Passwd) ->
%%% Bind. %%% Bind.
%%% Example: %%% Example:
%%% %%%
%%% bind(Handle, %%% bind(Handle,
%%% "cn=Bill Valentine, ou=people, o=Bluetail AB, dc=bluetail, dc=com", %%% "cn=Bill Valentine, ou=people, o=Bluetail AB, dc=bluetail, dc=com",
%%% "secret") %%% "secret")
%%% -------------------------------------------------------------------- %%% --------------------------------------------------------------------
-spec bind(handle(), binary(), binary()) -> any(). -spec bind(handle(), binary(), binary()) -> any().
bind(Handle, RootDN, Passwd) -> bind(Handle, RootDN, Passwd) ->
Handle1 = get_handle(Handle), Handle1 = get_handle(Handle),
p1_fsm:sync_send_event(Handle1, {bind, RootDN, Passwd}, p1_fsm:sync_send_event(Handle1, {bind, RootDN, Passwd},
@ -308,7 +308,7 @@ optional([]) -> asn1_NOVALUE;
optional(Value) -> Value. optional(Value) -> Value.
%%% -------------------------------------------------------------------- %%% --------------------------------------------------------------------
%%% Synchronous search of the Directory returning a %%% Synchronous search of the Directory returning a
%%% requested set of attributes. %%% requested set of attributes.
%%% %%%
%%% Example: %%% Example:
@ -560,9 +560,9 @@ get_handle(Name) when is_binary(Name) ->
%% Returns: {ok, StateName, StateData} | %% Returns: {ok, StateName, StateData} |
%% {ok, StateName, StateData, Timeout} | %% {ok, StateName, StateData, Timeout} |
%% ignore | %% ignore |
%% {stop, StopReason} %% {stop, StopReason}
%% I use the trick of setting a timeout of 0 to pass control into the %% I use the trick of setting a timeout of 0 to pass control into the
%% process. %% process.
%%---------------------------------------------------------------------- %%----------------------------------------------------------------------
init([Hosts, Port, Rootdn, Passwd, Opts]) -> init([Hosts, Port, Rootdn, Passwd, Opts]) ->
Encrypt = case proplists:get_value(encrypt, Opts) of Encrypt = case proplists:get_value(encrypt, Opts) of
@ -639,7 +639,7 @@ active(Event, From, S) ->
%% Called when p1_fsm:send_all_state_event/2 is invoked. %% Called when p1_fsm:send_all_state_event/2 is invoked.
%% Returns: {next_state, NextStateName, NextStateData} | %% Returns: {next_state, NextStateName, NextStateData} |
%% {next_state, NextStateName, NextStateData, Timeout} | %% {next_state, NextStateName, NextStateData, Timeout} |
%% {stop, Reason, NewStateData} %% {stop, Reason, NewStateData}
%%---------------------------------------------------------------------- %%----------------------------------------------------------------------
handle_event(close, _StateName, S) -> handle_event(close, _StateName, S) ->
catch (S#eldap.sockmod):close(S#eldap.fd), catch (S#eldap.sockmod):close(S#eldap.fd),
@ -655,7 +655,7 @@ handle_sync_event(_Event, _From, StateName, S) ->
%% %%
handle_info({Tag, _Socket, Data}, connecting, S) handle_info({Tag, _Socket, Data}, connecting, S)
when Tag == tcp; Tag == ssl -> when Tag == tcp; Tag == ssl ->
?DEBUG("tcp packet received when disconnected!~n~p", [Data]), ?DEBUG("TCP packet received when disconnected!~n~p", [Data]),
{next_state, connecting, S}; {next_state, connecting, S};
handle_info({Tag, _Socket, Data}, wait_bind_response, S) handle_info({Tag, _Socket, Data}, wait_bind_response, S)
when Tag == tcp; Tag == ssl -> when Tag == tcp; Tag == ssl ->
@ -721,7 +721,7 @@ handle_info({timeout, _Timer, bind_timeout}, wait_bind_response, S) ->
%% Make sure we don't fill the message queue with rubbish %% Make sure we don't fill the message queue with rubbish
%% %%
handle_info(Info, StateName, S) -> handle_info(Info, StateName, S) ->
?DEBUG("eldap. Unexpected Info: ~p~nIn state: " ?DEBUG("Unexpected Info: ~p~nIn state: "
"~p~n when StateData is: ~p", "~p~n when StateData is: ~p",
[Info, StateName, S]), [Info, StateName, S]),
{next_state, StateName, S}. {next_state, StateName, S}.
@ -822,7 +822,7 @@ gen_req({bind, RootDN, Passwd}) ->
%% recvd_packet %% recvd_packet
%% Deals with incoming packets in the active state %% Deals with incoming packets in the active state
%% Will return one of: %% Will return one of:
%% {ok, NewS} - Don't reply to client yet as this is part of a search %% {ok, NewS} - Don't reply to client yet as this is part of a search
%% result and we haven't got all the answers yet. %% result and we haven't got all the answers yet.
%% {reply, Result, From, NewS} - Reply with result to client From %% {reply, Result, From, NewS} - Reply with result to client From
%% {error, Reason} %% {error, Reason}

View File

@ -112,7 +112,7 @@ process_iq(_Host, Module, Function, IQ) ->
ignore -> ignore ->
ok ok
catch ?EX_RULE(E, R, St) -> catch ?EX_RULE(E, R, St) ->
?ERROR_MSG("failed to process iq:~n~s~nReason = ~p", ?ERROR_MSG("Failed to process iq:~n~s~nReason = ~p",
[xmpp:pp(IQ), {E, {R, ?EX_STACK(St)}}]), [xmpp:pp(IQ), {E, {R, ?EX_STACK(St)}}]),
Txt = ?T("Module failed to handle the query"), Txt = ?T("Module failed to handle the query"),
Err = xmpp:err_internal_server_error(Txt, IQ#iq.lang), Err = xmpp:err_internal_server_error(Txt, IQ#iq.lang),

View File

@ -144,7 +144,7 @@ xdb_data(User, Server, #xmlel{attrs = Attrs} = El) ->
From, From,
[{XMLNS, El#xmlel{attrs = NewAttrs}}]); [{XMLNS, El#xmlel{attrs = NewAttrs}}]);
_ -> _ ->
?DEBUG("jd2ejd: Unknown namespace \"~s\"~n", [XMLNS]) ?DEBUG("Unknown namespace \"~s\"~n", [XMLNS])
end, end,
ok ok
end. end.
@ -166,7 +166,7 @@ process_offline(Server, To, #xmlel{children = Els}) ->
ok ok
catch _:{xmpp_codec, Why} -> catch _:{xmpp_codec, Why} ->
Txt = xmpp:format_error(Why), Txt = xmpp:format_error(Why),
?ERROR_MSG("failed to decode XML '~s': ~s", ?ERROR_MSG("Failed to decode XML '~s': ~s",
[fxml:element_to_binary(El), Txt]) [fxml:element_to_binary(El), Txt])
end end
end, Els). end, Els).

View File

@ -849,7 +849,7 @@ check_password_hash(User, Host, PasswordHash, HashMethod) ->
{A, _} when is_tuple(A) -> scrammed; {A, _} when is_tuple(A) -> scrammed;
{_, true} -> get_hash(AccountPass, HashMethod); {_, true} -> get_hash(AccountPass, HashMethod);
{_, false} -> {_, false} ->
?ERROR_MSG("check_password_hash called " ?ERROR_MSG("Check_password_hash called "
"with hash method: ~p", [HashMethod]), "with hash method: ~p", [HashMethod]),
undefined undefined
end, end,

View File

@ -143,12 +143,12 @@ handle_cast({F, #message{from = From, to = To} = Pkt}, State) when is_atom(F) ->
end, end,
{noreply, State}; {noreply, State};
handle_cast(Msg, State) -> handle_cast(Msg, State) ->
?WARNING_MSG("unexpected cast: ~p", [Msg]), ?WARNING_MSG("Unexpected cast: ~p", [Msg]),
{noreply, State}. {noreply, State}.
handle_info(Info, State) -> handle_info(Info, State) ->
?WARNING_MSG("unexpected info: ~p", [Info]), ?WARNING_MSG("Unexpected info: ~p", [Info]),
{noreply, State}. {noreply, State}.
terminate(_Reason, #state{host = Host}) -> terminate(_Reason, #state{host = Host}) ->
@ -597,7 +597,7 @@ handle_adhoc_form(From, #jid{lserver = LServer} = To,
Junk -> Junk ->
%% This can't happen, as we haven't registered any other %% This can't happen, as we haven't registered any other
%% command nodes. %% command nodes.
?ERROR_MSG("got unexpected node/body = ~p", [Junk]), ?ERROR_MSG("Unexpected node/body = ~p", [Junk]),
{error, xmpp:err_internal_server_error()} {error, xmpp:err_internal_server_error()}
end. end.
@ -722,7 +722,7 @@ send_motd({#presence{type = available},
ok ok
end end
catch _:{xmpp_codec, Why} -> catch _:{xmpp_codec, Why} ->
?ERROR_MSG("failed to decode motd packet ~p: ~s", ?ERROR_MSG("Failed to decode motd packet ~p: ~s",
[Packet, xmpp:format_error(Why)]) [Packet, xmpp:format_error(Why)])
end; end;
_ -> _ ->
@ -806,7 +806,7 @@ get_stored_motd(LServer) ->
#message{body = Body, subject = Subject} -> #message{body = Body, subject = Subject} ->
{xmpp:get_text(Subject), xmpp:get_text(Body)} {xmpp:get_text(Subject), xmpp:get_text(Body)}
catch _:{xmpp_codec, Why} -> catch _:{xmpp_codec, Why} ->
?ERROR_MSG("failed to decode motd packet ~p: ~s", ?ERROR_MSG("Failed to decode motd packet ~p: ~s",
[Packet, xmpp:format_error(Why)]) [Packet, xmpp:format_error(Why)])
end; end;
_ -> _ ->

View File

@ -154,7 +154,7 @@ parse_element(XML) ->
El when is_record(El, xmlel) -> El when is_record(El, xmlel) ->
{ok, El}; {ok, El};
_ -> _ ->
?ERROR_MSG("malformed XML element in SQL table " ?ERROR_MSG("Malformed XML element in SQL table "
"'motd' for username='': ~s", [XML]), "'motd' for username='': ~s", [XML]),
{error, db_failure} {error, db_failure}
end. end.

View File

@ -95,11 +95,11 @@ pubsub_publish_item(LServer, ?NS_AVATAR_METADATA,
set_vcard_avatar(From, Photo, #{}) set_vcard_avatar(From, Photo, #{})
end; end;
_ -> _ ->
?WARNING_MSG("invalid avatar metadata of ~s@~s published " ?WARNING_MSG("Invalid avatar metadata of ~s@~s published "
"with item id ~s", "with item id ~s",
[LUser, LServer, ItemId]) [LUser, LServer, ItemId])
catch _:{xmpp_codec, Why} -> catch _:{xmpp_codec, Why} ->
?WARNING_MSG("failed to decode avatar metadata of ~s@~s: ~s", ?WARNING_MSG("Failed to decode avatar metadata of ~s@~s: ~s",
[LUser, LServer, xmpp:format_error(Why)]) [LUser, LServer, xmpp:format_error(Why)])
end; end;
pubsub_publish_item(_, _, _, _, _, _) -> pubsub_publish_item(_, _, _, _, _, _) ->
@ -208,12 +208,12 @@ get_avatar_data(JID, ItemID) ->
#avatar_data{data = Data} -> #avatar_data{data = Data} ->
{ok, Data}; {ok, Data};
_ -> _ ->
?WARNING_MSG("invalid avatar data detected " ?WARNING_MSG("Invalid avatar data detected "
"for ~s@~s with item id ~s", "for ~s@~s with item id ~s",
[LUser, LServer, ItemID]), [LUser, LServer, ItemID]),
{error, invalid_data} {error, invalid_data}
catch _:{xmpp_codec, Why} -> catch _:{xmpp_codec, Why} ->
?WARNING_MSG("failed to decode avatar data for " ?WARNING_MSG("Failed to decode avatar data for "
"~s@~s with item id ~s: ~s", "~s@~s with item id ~s: ~s",
[LUser, LServer, ItemID, [LUser, LServer, ItemID,
xmpp:format_error(Why)]), xmpp:format_error(Why)]),
@ -227,7 +227,7 @@ get_avatar_data(JID, ItemID) ->
{error, #stanza_error{reason = 'item-not-found'}} -> {error, #stanza_error{reason = 'item-not-found'}} ->
{error, notfound}; {error, notfound};
{error, Reason} -> {error, Reason} ->
?WARNING_MSG("failed to get item for ~s@~s at node ~s " ?WARNING_MSG("Failed to get item for ~s@~s at node ~s "
"with item id ~s: ~p", "with item id ~s: ~p",
[LUser, LServer, ?NS_AVATAR_METADATA, ItemID, Reason]), [LUser, LServer, ?NS_AVATAR_METADATA, ItemID, Reason]),
{error, internal_error} {error, internal_error}
@ -246,12 +246,12 @@ get_avatar_meta(#iq{from = JID}) ->
#avatar_meta{} = Meta -> #avatar_meta{} = Meta ->
{ok, ItemID, Meta}; {ok, ItemID, Meta};
_ -> _ ->
?WARNING_MSG("invalid metadata payload detected " ?WARNING_MSG("Invalid metadata payload detected "
"for ~s@~s with item id ~s", "for ~s@~s with item id ~s",
[LUser, LServer, ItemID]), [LUser, LServer, ItemID]),
{error, invalid_metadata} {error, invalid_metadata}
catch _:{xmpp_codec, Why} -> catch _:{xmpp_codec, Why} ->
?WARNING_MSG("failed to decode metadata for " ?WARNING_MSG("Failed to decode metadata for "
"~s@~s with item id ~s: ~s", "~s@~s with item id ~s: ~s",
[LUser, LServer, ItemID, [LUser, LServer, ItemID,
xmpp:format_error(Why)]), xmpp:format_error(Why)]),
@ -260,7 +260,7 @@ get_avatar_meta(#iq{from = JID}) ->
{error, #stanza_error{reason = 'item-not-found'}} -> {error, #stanza_error{reason = 'item-not-found'}} ->
{error, notfound}; {error, notfound};
{error, Reason} -> {error, Reason} ->
?WARNING_MSG("failed to get items for ~s@~s at node ~s: ~p", ?WARNING_MSG("Failed to get items for ~s@~s at node ~s: ~p",
[LUser, LServer, ?NS_AVATAR_METADATA, Reason]), [LUser, LServer, ?NS_AVATAR_METADATA, Reason]),
{error, internal_error} {error, internal_error}
end. end.
@ -392,11 +392,11 @@ get_vcard(#jid{luser = LUser, lserver = LServer}) ->
#vcard_temp{} = VCard -> #vcard_temp{} = VCard ->
{ok, VCard}; {ok, VCard};
_ -> _ ->
?ERROR_MSG("invalid vCard of ~s@~s in the database", ?ERROR_MSG("Invalid vCard of ~s@~s in the database",
[LUser, LServer]), [LUser, LServer]),
{error, invalid_vcard} {error, invalid_vcard}
catch _:{xmpp_codec, Why} -> catch _:{xmpp_codec, Why} ->
?ERROR_MSG("failed to decode vCard of ~s@~s: ~s", ?ERROR_MSG("Failed to decode vCard of ~s@~s: ~s",
[LUser, LServer, xmpp:format_error(Why)]), [LUser, LServer, xmpp:format_error(Why)]),
{error, invalid_vcard} {error, invalid_vcard}
end. end.

View File

@ -116,7 +116,7 @@ handle_info({delete, Session}, State) ->
delete_session(Session), delete_session(Session),
{noreply, State}; {noreply, State};
handle_info(_Info, State) -> handle_info(_Info, State) ->
?ERROR_MSG("got unexpected info: ~p", [_Info]), ?ERROR_MSG("Unexpected info: ~p", [_Info]),
{noreply, State}. {noreply, State}.
terminate(_Reason, _State) -> terminate(_Reason, _State) ->

View File

@ -89,7 +89,7 @@ find_session(SID) ->
try try
{ok, binary_to_term(Pid)} {ok, binary_to_term(Pid)}
catch _:badarg -> catch _:badarg ->
?ERROR_MSG("malformed data in redis (key = '~s'): ~p", ?ERROR_MSG("Malformed data in redis (key = '~s'): ~p",
[SID, Pid]), [SID, Pid]),
{error, db_failure} {error, db_failure}
end; end;
@ -118,7 +118,7 @@ handle_info({redis_message, ?BOSH_KEY, SID}, State) ->
ets_cache:delete(?BOSH_CACHE, SID), ets_cache:delete(?BOSH_CACHE, SID),
{noreply, State}; {noreply, State};
handle_info(Info, State) -> handle_info(Info, State) ->
?ERROR_MSG("unexpected info: ~p", [Info]), ?ERROR_MSG("Unexpected info: ~p", [Info]),
{noreply, State}. {noreply, State}.
terminate(_Reason, _State) -> terminate(_Reason, _State) ->
@ -145,5 +145,5 @@ clean_table() ->
end), end),
ok; ok;
{error, _} -> {error, _} ->
?ERROR_MSG("failed to clean bosh sessions in redis", []) ?ERROR_MSG("Failed to clean bosh sessions in redis", [])
end. end.

View File

@ -66,6 +66,6 @@ clean_table() ->
ok ok
end, Rs); end, Rs);
{error, Reason} = Err -> {error, Reason} = Err ->
?ERROR_MSG("failed to clean Riak 'bosh' table: ~p", [Reason]), ?ERROR_MSG("Failed to clean Riak 'bosh' table: ~p", [Reason]),
Err Err
end. end.

View File

@ -44,7 +44,7 @@ init() ->
{updated, _} -> {updated, _} ->
ok; ok;
Err -> Err ->
?ERROR_MSG("failed to clean 'route' table: ~p", [Err]), ?ERROR_MSG("Failed to clean 'route' table: ~p", [Err]),
Err Err
end. end.

View File

@ -295,7 +295,7 @@ handle_info({iq_reply, IQReply, {Host, From, To, Caps, SubNodes}}, State) ->
feature_response(IQReply, Host, From, To, Caps, SubNodes), feature_response(IQReply, Host, From, To, Caps, SubNodes),
{noreply, State}; {noreply, State};
handle_info(Info, State) -> handle_info(Info, State) ->
?WARNING_MSG("unexpected info: ~p", [Info]), ?WARNING_MSG("Unexpected info: ~p", [Info]),
{noreply, State}. {noreply, State}.
terminate(_Reason, State) -> terminate(_Reason, State) ->

View File

@ -205,7 +205,7 @@ handle_info({iq_reply, ResIQ, #iq{} = IQ}, State) ->
process_iq_result(IQ, ResIQ), process_iq_result(IQ, ResIQ),
{noreply, State}; {noreply, State};
handle_info(Info, State) -> handle_info(Info, State) ->
?WARNING_MSG("unexpected info: ~p", [Info]), ?WARNING_MSG("Unexpected info: ~p", [Info]),
{noreply, State}. {noreply, State}.
terminate(_Reason, State) -> terminate(_Reason, State) ->
@ -277,7 +277,7 @@ process_iq_result(#iq{from = From, to = To, id = ID, lang = Lang} = IQ,
ejabberd_router:route(Reply) ejabberd_router:route(Reply)
end end
catch _:_ -> catch _:_ ->
?ERROR_MSG("got iq-result with invalid delegated " ?ERROR_MSG("Got iq-result with invalid delegated "
"payload:~n~s", [xmpp:pp(ResIQ)]), "payload:~n~s", [xmpp:pp(ResIQ)]),
Txt = ?T("External component failure"), Txt = ?T("External component failure"),
Err = xmpp:err_internal_server_error(Txt, Lang), Err = xmpp:err_internal_server_error(Txt, Lang),

View File

@ -140,11 +140,11 @@ handle_call(_Request, _From, State) ->
{reply, Reply, State}. {reply, Reply, State}.
handle_cast(_Msg, State) -> handle_cast(_Msg, State) ->
?ERROR_MSG("got unexpected cast = ~p", [_Msg]), ?ERROR_MSG("Unexpected cast = ~p", [_Msg]),
{noreply, State}. {noreply, State}.
handle_info(clean, State) -> handle_info(clean, State) ->
?DEBUG("cleaning ~p ETS table", [failed_auth]), ?DEBUG("Cleaning ~p ETS table", [failed_auth]),
Now = erlang:system_time(second), Now = erlang:system_time(second),
ets:select_delete( ets:select_delete(
failed_auth, failed_auth,
@ -152,7 +152,7 @@ handle_info(clean, State) ->
erlang:send_after(?CLEAN_INTERVAL, self(), clean), erlang:send_after(?CLEAN_INTERVAL, self(), clean),
{noreply, State}; {noreply, State};
handle_info(_Info, State) -> handle_info(_Info, State) ->
?ERROR_MSG("got unexpected info = ~p", [_Info]), ?ERROR_MSG("Unexpected info = ~p", [_Info]),
{noreply, State}. {noreply, State}.
terminate(_Reason, #state{host = Host}) -> terminate(_Reason, #state{host = Host}) ->

View File

@ -400,7 +400,7 @@ format_arg({Elements},
_ when TElDef == binary; TElDef == string -> _ when TElDef == binary; TElDef == string ->
<<"">>; <<"">>;
_ -> _ ->
?ERROR_MSG("missing field ~p in tuple ~p", [TElName, Elements]), ?ERROR_MSG("Missing field ~p in tuple ~p", [TElName, Elements]),
throw({invalid_parameter, throw({invalid_parameter,
io_lib:format("Missing field ~w in tuple ~w", [TElName, Elements])}) io_lib:format("Missing field ~w in tuple ~w", [TElName, Elements])})
end end
@ -418,7 +418,7 @@ format_arg(Arg, string) when is_binary(Arg) -> binary_to_list(Arg);
format_arg(undefined, binary) -> <<>>; format_arg(undefined, binary) -> <<>>;
format_arg(undefined, string) -> ""; format_arg(undefined, string) -> "";
format_arg(Arg, Format) -> format_arg(Arg, Format) ->
?ERROR_MSG("don't know how to format Arg ~p for format ~p", [Arg, Format]), ?ERROR_MSG("Don't know how to format Arg ~p for format ~p", [Arg, Format]),
throw({invalid_parameter, throw({invalid_parameter,
io_lib:format("Arg ~w is not in format ~w", io_lib:format("Arg ~w is not in format ~w",
[Arg, Format])}). [Arg, Format])}).

View File

@ -136,7 +136,7 @@ initialize(Host, Opts) ->
ContentTypes = build_list_content_types( ContentTypes = build_list_content_types(
mod_http_fileserver_opt:content_types(Opts), mod_http_fileserver_opt:content_types(Opts),
?DEFAULT_CONTENT_TYPES), ?DEFAULT_CONTENT_TYPES),
?DEBUG("known content types: ~s", ?DEBUG("Known content types: ~s",
[str:join([[$*, K, " -> ", V] || {K, V} <- ContentTypes], [str:join([[$*, K, " -> ", V] || {K, V} <- ContentTypes],
<<", ">>)]), <<", ">>)]),
#state{host = Host, #state{host = Host,
@ -222,7 +222,7 @@ handle_cast({reload, Host, NewOpts, _OldOpts}, OldState) ->
{noreply, OldState} {noreply, OldState}
end; end;
handle_cast(Msg, State) -> handle_cast(Msg, State) ->
?WARNING_MSG("unexpected cast: ~p", [Msg]), ?WARNING_MSG("Unexpected cast: ~p", [Msg]),
{noreply, State}. {noreply, State}.
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------

View File

@ -300,12 +300,12 @@ handle_call(get_conf, _From,
custom_headers = CustomHeaders} = State) -> custom_headers = CustomHeaders} = State) ->
{reply, {ok, DocRoot, CustomHeaders}, State}; {reply, {ok, DocRoot, CustomHeaders}, State};
handle_call(Request, From, State) -> handle_call(Request, From, State) ->
?ERROR_MSG("Got unexpected request from ~p: ~p", [From, Request]), ?ERROR_MSG("Unexpected request from ~p: ~p", [From, Request]),
{noreply, State}. {noreply, State}.
-spec handle_cast(_, state()) -> {noreply, state()}. -spec handle_cast(_, state()) -> {noreply, state()}.
handle_cast(Request, State) -> handle_cast(Request, State) ->
?ERROR_MSG("Got unexpected request: ~p", [Request]), ?ERROR_MSG("Unexpected request: ~p", [Request]),
{noreply, State}. {noreply, State}.
-spec handle_info(timeout | _, state()) -> {noreply, state()}. -spec handle_info(timeout | _, state()) -> {noreply, state()}.
@ -336,7 +336,7 @@ handle_info({timeout, _TRef, Slot}, State) ->
NewState = del_slot(Slot, State), NewState = del_slot(Slot, State),
{noreply, NewState}; {noreply, NewState};
handle_info(Info, State) -> handle_info(Info, State) ->
?ERROR_MSG("Got unexpected info: ~p", [Info]), ?ERROR_MSG("Unexpected info: ~p", [Info]),
{noreply, State}. {noreply, State}.
-spec terminate(normal | shutdown | {shutdown, _} | _, state()) -> ok. -spec terminate(normal | shutdown | {shutdown, _} | _, state()) -> ok.
@ -640,7 +640,7 @@ create_slot(#state{service_url = ServiceURL},
[jid:encode(JID), ServiceURL]), [jid:encode(JID), ServiceURL]),
{error, xmpp:err_not_acceptable()}; {error, xmpp:err_not_acceptable()};
{ok, {Code, _Body}} -> {ok, {Code, _Body}} ->
?ERROR_MSG("Got unexpected status code for ~s from <~s>: ~B", ?ERROR_MSG("Unexpected status code for ~s from <~s>: ~B",
[jid:encode(JID), ServiceURL, Code]), [jid:encode(JID), ServiceURL, Code]),
{error, xmpp:err_service_unavailable()}; {error, xmpp:err_service_unavailable()};
{error, Reason} -> {error, Reason} ->

View File

@ -124,7 +124,7 @@ init([ServerHost, Opts]) ->
-spec handle_call(_, {pid(), _}, state()) -> {noreply, state()}. -spec handle_call(_, {pid(), _}, state()) -> {noreply, state()}.
handle_call(Request, From, State) -> handle_call(Request, From, State) ->
?ERROR_MSG("Got unexpected request from ~p: ~p", [From, Request]), ?ERROR_MSG("Unexpected request from ~p: ~p", [From, Request]),
{noreply, State}. {noreply, State}.
-spec handle_cast(_, state()) -> {noreply, state()}. -spec handle_cast(_, state()) -> {noreply, state()}.
@ -181,7 +181,7 @@ handle_cast({handle_slot_request, #jid{user = U, server = S} = JID, Path, Size},
end, end,
{noreply, State#state{disk_usage = NewDiskUsage}}; {noreply, State#state{disk_usage = NewDiskUsage}};
handle_cast(Request, State) -> handle_cast(Request, State) ->
?ERROR_MSG("Got unexpected request: ~p", [Request]), ?ERROR_MSG("Unexpected request: ~p", [Request]),
{noreply, State}. {noreply, State}.
-spec handle_info(_, state()) -> {noreply, state()}. -spec handle_info(_, state()) -> {noreply, state()}.
@ -207,7 +207,7 @@ handle_info(sweep, #state{server_host = ServerHost,
end, end,
{noreply, State}; {noreply, State};
handle_info(Info, State) -> handle_info(Info, State) ->
?ERROR_MSG("Got unexpected info: ~p", [Info]), ?ERROR_MSG("Unexpected info: ~p", [Info]),
{noreply, State}. {noreply, State}.
-spec terminate(normal | shutdown | {shutdown, _} | _, state()) -> ok. -spec terminate(normal | shutdown | {shutdown, _} | _, state()) -> ok.

View File

@ -173,7 +173,7 @@ get_socket(N) ->
get_socket(N-1) get_socket(N-1)
end; end;
{error, Reason} = Err -> {error, Reason} = Err ->
?ERROR_MSG("can not open udp socket to grapherl: ~s", ?ERROR_MSG("Can not open udp socket to grapherl: ~s",
[inet:format_error(Reason)]), [inet:format_error(Reason)]),
Err Err
end; end;

View File

@ -186,7 +186,7 @@ handle_call({get_state, Pid}, From, State) ->
noreply(State3) noreply(State3)
end; end;
handle_call(Request, From, State) -> handle_call(Request, From, State) ->
?WARNING_MSG("Got unexpected call from ~p: ~p", [From, Request]), ?WARNING_MSG("Unexpected call from ~p: ~p", [From, Request]),
noreply(State). noreply(State).
handle_cast(accept, #state{socket = {_, Sock}} = State) -> handle_cast(accept, #state{socket = {_, Sock}} = State) ->
@ -204,7 +204,7 @@ handle_cast(accept, #state{socket = {_, Sock}} = State) ->
stop(State, {socket, Why}) stop(State, {socket, Why})
end; end;
handle_cast(Msg, State) -> handle_cast(Msg, State) ->
?WARNING_MSG("Got unexpected cast: ~p", [Msg]), ?WARNING_MSG("Unexpected cast: ~p", [Msg]),
noreply(State). noreply(State).
handle_info(Msg, #state{stop_reason = {resumed, Pid} = Reason} = State) -> handle_info(Msg, #state{stop_reason = {resumed, Pid} = Reason} = State) ->
@ -275,7 +275,7 @@ handle_info({Ref, badarg}, State) when is_reference(Ref) ->
%% TODO: figure out from where this messages comes from %% TODO: figure out from where this messages comes from
noreply(State); noreply(State);
handle_info(Info, State) -> handle_info(Info, State) ->
?WARNING_MSG("Got unexpected info: ~p", [Info]), ?WARNING_MSG("Unexpected info: ~p", [Info]),
noreply(State). noreply(State).
-spec handle_packet(mqtt_packet(), state()) -> {ok, state()} | -spec handle_packet(mqtt_packet(), state()) -> {ok, state()} |
@ -308,7 +308,7 @@ handle_packet(#pubrec{id = ID, code = Code}, State) ->
{ok, State}; {ok, State};
false -> false ->
Code1 = 'packet-identifier-not-found', Code1 = 'packet-identifier-not-found',
?DEBUG("Got unexpected PUBREC with id=~B, " ?DEBUG("Unexpected PUBREC with id=~B, "
"sending PUBREL with error code '~s'", [ID, Code1]), "sending PUBREL with error code '~s'", [ID, Code1]),
send(State, #pubrel{id = ID, code = Code1}) send(State, #pubrel{id = ID, code = Code1})
end; end;
@ -324,7 +324,7 @@ handle_packet(#pubrel{id = ID}, State) ->
send(State#state{acks = Acks}, #pubcomp{id = ID}); send(State#state{acks = Acks}, #pubcomp{id = ID});
error -> error ->
Code = 'packet-identifier-not-found', Code = 'packet-identifier-not-found',
?DEBUG("Got unexpected PUBREL with id=~B, " ?DEBUG("Unexpected PUBREL with id=~B, "
"sending PUBCOMP with error code '~s'", [ID, Code]), "sending PUBCOMP with error code '~s'", [ID, Code]),
Pubcomp = #pubcomp{id = ID, code = Code}, Pubcomp = #pubcomp{id = ID, code = Code},
send(State, Pubcomp) send(State, Pubcomp)

View File

@ -101,13 +101,13 @@ handle_call({send, Data}, _From, #state{ws_pid = WsPid} = State) ->
WsPid ! {data, Data}, WsPid ! {data, Data},
{reply, ok, State}; {reply, ok, State};
handle_call(Request, From, State) -> handle_call(Request, From, State) ->
?WARNING_MSG("Got unexpected call from ~p: ~p", [From, Request]), ?WARNING_MSG("Unexpected call from ~p: ~p", [From, Request]),
{noreply, State}. {noreply, State}.
handle_cast(close, State) -> handle_cast(close, State) ->
{stop, normal, State#state{mqtt_session = undefined}}; {stop, normal, State#state{mqtt_session = undefined}};
handle_cast(Request, State) -> handle_cast(Request, State) ->
?WARNING_MSG("Got unexpected cast: ~p", [Request]), ?WARNING_MSG("Unexpected cast: ~p", [Request]),
{noreply, State}. {noreply, State}.
handle_info(closed, State) -> handle_info(closed, State) ->
@ -119,7 +119,7 @@ handle_info({'DOWN', _, process, Pid, _}, State)
when Pid == State#state.mqtt_session orelse Pid == State#state.ws_pid -> when Pid == State#state.mqtt_session orelse Pid == State#state.ws_pid ->
{stop, normal, State}; {stop, normal, State};
handle_info(Info, State) -> handle_info(Info, State) ->
?WARNING_MSG("Got unexpected info: ~p", [Info]), ?WARNING_MSG("Unexpected info: ~p", [Info]),
{noreply, State}. {noreply, State}.
terminate(_Reason, State) -> terminate(_Reason, State) ->

View File

@ -310,7 +310,7 @@ handle_cast({reload, ServerHost, NewOpts, OldOpts}, #state{hosts = OldHosts}) ->
end, misc:intersection(NewHosts, OldHosts)), end, misc:intersection(NewHosts, OldHosts)),
{noreply, NewState}; {noreply, NewState};
handle_cast(Msg, State) -> handle_cast(Msg, State) ->
?WARNING_MSG("unexpected cast: ~p", [Msg]), ?WARNING_MSG("Unexpected cast: ~p", [Msg]),
{noreply, State}. {noreply, State}.
handle_info({route, Packet}, handle_info({route, Packet},
@ -337,7 +337,7 @@ handle_info({room_destroyed, {Room, Host}, Pid}, State) ->
RMod:unregister_online_room(ServerHost, Room, Host, Pid), RMod:unregister_online_room(ServerHost, Room, Host, Pid),
{noreply, State}; {noreply, State};
handle_info(Info, State) -> handle_info(Info, State) ->
?ERROR_MSG("unexpected info: ~p", [Info]), ?ERROR_MSG("Unexpected info: ~p", [Info]),
{noreply, State}. {noreply, State}.
terminate(_Reason, #state{hosts = MyHosts}) -> terminate(_Reason, #state{hosts = MyHosts}) ->

View File

@ -115,7 +115,7 @@ handle_cast({add_to_log, Type, Data, Room, Opts}, State) ->
end, end,
{noreply, State}; {noreply, State};
handle_cast(Msg, State) -> handle_cast(Msg, State) ->
?WARNING_MSG("unexpected cast: ~p", [Msg]), ?WARNING_MSG("Unexpected cast: ~p", [Msg]),
{noreply, State}. {noreply, State}.
handle_info(_Info, State) -> {noreply, State}. handle_info(_Info, State) -> {noreply, State}.

View File

@ -342,7 +342,7 @@ handle_info({mnesia_system_event, {mnesia_down, Node}}, State) ->
handle_info({mnesia_system_event, {mnesia_up, _Node}}, State) -> handle_info({mnesia_system_event, {mnesia_up, _Node}}, State) ->
{noreply, State}; {noreply, State};
handle_info(Info, State) -> handle_info(Info, State) ->
?ERROR_MSG("unexpected info: ~p", [Info]), ?ERROR_MSG("Unexpected info: ~p", [Info]),
{noreply, State}. {noreply, State}.
terminate(_Reason, _State) -> terminate(_Reason, _State) ->

View File

@ -2783,7 +2783,7 @@ process_item_change(Item, SD, UJID) ->
undefined -> undefined ->
<<"">> <<"">>
end, end,
?ERROR_MSG("failed to set item ~p~s: ~p", ?ERROR_MSG("Failed to set item ~p~s: ~p",
[Item, FromSuffix, {E, {R, ?EX_STACK(St)}}]), [Item, FromSuffix, {E, {R, ?EX_STACK(St)}}]),
{error, xmpp:err_internal_server_error()} {error, xmpp:err_internal_server_error()}
end. end.

View File

@ -431,7 +431,7 @@ clean_tables(ServerHost) ->
{updated, _} -> {updated, _} ->
ok; ok;
Err1 -> Err1 ->
?ERROR_MSG("failed to clean 'muc_online_room' table: ~p", [Err1]), ?ERROR_MSG("Failed to clean 'muc_online_room' table: ~p", [Err1]),
Err1 Err1
end, end,
?DEBUG("Cleaning SQL muc_online_users table...", []), ?DEBUG("Cleaning SQL muc_online_users table...", []),
@ -441,6 +441,6 @@ clean_tables(ServerHost) ->
{updated, _} -> {updated, _} ->
ok; ok;
Err2 -> Err2 ->
?ERROR_MSG("failed to clean 'muc_online_users' table: ~p", [Err2]), ?ERROR_MSG("Failed to clean 'muc_online_users' table: ~p", [Err2]),
Err2 Err2
end. end.

View File

@ -183,7 +183,7 @@ handle_cast({reload, NewOpts, NewOpts},
{noreply, State#state{lservice = NewLServiceS, {noreply, State#state{lservice = NewLServiceS,
access = Access, service_limits = SLimits}}; access = Access, service_limits = SLimits}};
handle_cast(Msg, State) -> handle_cast(Msg, State) ->
?WARNING_MSG("unexpected cast: ~p", [Msg]), ?WARNING_MSG("Unexpected cast: ~p", [Msg]),
{noreply, State}. {noreply, State}.
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------

View File

@ -698,7 +698,7 @@ offline_msg_to_route(LServer, #offline_msg{from = From, to = To} = R) ->
Pkt2 = add_delay_info(Pkt1, LServer, R#offline_msg.timestamp), Pkt2 = add_delay_info(Pkt1, LServer, R#offline_msg.timestamp),
{route, Pkt2} {route, Pkt2}
catch _:{xmpp_codec, Why} -> catch _:{xmpp_codec, Why} ->
?ERROR_MSG("failed to decode packet ~p of user ~s: ~s", ?ERROR_MSG("Failed to decode packet ~p of user ~s: ~s",
[R#offline_msg.packet, jid:encode(To), [R#offline_msg.packet, jid:encode(To),
xmpp:format_error(Why)]), xmpp:format_error(Why)]),
error error
@ -728,7 +728,7 @@ read_db_messages(LUser, LServer) ->
Pkt2 = xmpp:set_from_to(Pkt1, From, To), Pkt2 = xmpp:set_from_to(Pkt1, From, To),
[{Node, Pkt2}] [{Node, Pkt2}]
catch _:{xmpp_codec, Why} -> catch _:{xmpp_codec, Why} ->
?ERROR_MSG("failed to decode packet ~p " ?ERROR_MSG("Failed to decode packet ~p "
"of user ~s: ~s", "of user ~s: ~s",
[El, jid:encode(To), [El, jid:encode(To),
xmpp:format_error(Why)]), xmpp:format_error(Why)]),

View File

@ -216,7 +216,7 @@ export(_Server) ->
"server_host=%(LServer)s", "server_host=%(LServer)s",
"xml=%(XML)s"])] "xml=%(XML)s"])]
catch _:{xmpp_codec, Why} -> catch _:{xmpp_codec, Why} ->
?ERROR_MSG("failed to decode packet ~p of user ~s@~s: ~s", ?ERROR_MSG("Failed to decode packet ~p of user ~s@~s: ~s",
[El, LUser, LServer, xmpp:format_error(Why)]), [El, LUser, LServer, xmpp:format_error(Why)]),
[] []
end; end;
@ -235,7 +235,7 @@ xml_to_offline_msg(XML) ->
#xmlel{} = El -> #xmlel{} = El ->
el_to_offline_msg(El); el_to_offline_msg(El);
Err -> Err ->
?ERROR_MSG("got ~p when parsing XML packet ~s", ?ERROR_MSG("Got ~p when parsing XML packet ~s",
[Err, XML]), [Err, XML]),
Err Err
end. end.
@ -251,10 +251,10 @@ el_to_offline_msg(El) ->
to = To, to = To,
packet = El}} packet = El}}
catch _:{bad_jid, To_s} -> catch _:{bad_jid, To_s} ->
?ERROR_MSG("failed to get 'to' JID from offline XML ~p", [El]), ?ERROR_MSG("Failed to get 'to' JID from offline XML ~p", [El]),
{error, bad_jid_to}; {error, bad_jid_to};
_:{bad_jid, From_s} -> _:{bad_jid, From_s} ->
?ERROR_MSG("failed to get 'from' JID from offline XML ~p", [El]), ?ERROR_MSG("Failed to get 'from' JID from offline XML ~p", [El]),
{error, bad_jid_from} {error, bad_jid_from}
end. end.

View File

@ -125,7 +125,7 @@ handle_cast({stop_ping, JID}, State) ->
Timers = del_timer(JID, State#state.timers), Timers = del_timer(JID, State#state.timers),
{noreply, State#state{timers = Timers}}; {noreply, State#state{timers = Timers}};
handle_cast(Msg, State) -> handle_cast(Msg, State) ->
?WARNING_MSG("unexpected cast: ~p", [Msg]), ?WARNING_MSG("Unexpected cast: ~p", [Msg]),
{noreply, State}. {noreply, State}.
handle_info({iq_reply, #iq{type = error}, JID}, State) -> handle_info({iq_reply, #iq{type = error}, JID}, State) ->

View File

@ -286,7 +286,7 @@ raw_to_item({SType, SValue, SAction, Order, MatchAll,
match_presence_in = MatchPresenceIn, match_presence_in = MatchPresenceIn,
match_presence_out = MatchPresenceOut}] match_presence_out = MatchPresenceOut}]
catch _:_ -> catch _:_ ->
?WARNING_MSG("failed to parse row: ~p", [Row]), ?WARNING_MSG("Failed to parse row: ~p", [Row]),
[] []
end. end.

View File

@ -133,7 +133,7 @@ parse_element(LUser, LServer, XML) ->
El when is_record(El, xmlel) -> El when is_record(El, xmlel) ->
{ok, El}; {ok, El};
_ -> _ ->
?ERROR_MSG("malformed XML element in SQL table " ?ERROR_MSG("Malformed XML element in SQL table "
"'private_storage' for user ~s@~s: ~s", "'private_storage' for user ~s@~s: ~s",
[LUser, LServer, XML]), [LUser, LServer, XML]),
error error

View File

@ -95,7 +95,7 @@ register_stream(SID, Pid) ->
end), end),
ok; ok;
_:badarg -> _:badarg ->
?ERROR_MSG("malformed data in redis (key = '~s'): ~p", ?ERROR_MSG("Malformed data in redis (key = '~s'): ~p",
[SIDKey, Val]), [SIDKey, Val]),
{error, db_failure} {error, db_failure}
end end
@ -128,7 +128,7 @@ unregister_stream(SID) ->
catch _:badarg when Val == undefined -> catch _:badarg when Val == undefined ->
ok; ok;
_:badarg -> _:badarg ->
?ERROR_MSG("malformed data in redis (key = '~s'): ~p", ?ERROR_MSG("Malformed data in redis (key = '~s'): ~p",
[SIDKey, Val]), [SIDKey, Val]),
{error, db_failure} {error, db_failure}
end end
@ -163,7 +163,7 @@ activate_stream(SID, IJID, MaxConnections, _Node) ->
catch _:badarg when Val == undefined -> catch _:badarg when Val == undefined ->
{error, notfound}; {error, notfound};
_:badarg -> _:badarg ->
?ERROR_MSG("malformed data in redis (key = '~s'): ~p", ?ERROR_MSG("Malformed data in redis (key = '~s'): ~p",
[SIDKey, Val]), [SIDKey, Val]),
{error, db_failure} {error, db_failure}
end end

View File

@ -105,7 +105,7 @@ handle_cast({reload, ServerHost, NewOpts, OldOpts}, State) ->
end, OldHosts -- NewHosts), end, OldHosts -- NewHosts),
{noreply, State#state{myhosts = NewHosts}}; {noreply, State#state{myhosts = NewHosts}};
handle_cast(Msg, State) -> handle_cast(Msg, State) ->
?WARNING_MSG("unexpected cast: ~p", [Msg]), ?WARNING_MSG("Unexpected cast: ~p", [Msg]),
{noreply, State}. {noreply, State}.
code_change(_OldVsn, State, _Extra) -> {ok, State}. code_change(_OldVsn, State, _Extra) -> {ok, State}.
@ -213,7 +213,7 @@ process_bytestreams(#iq{type = set, lang = Lang, from = InitiatorJID, to = To,
Txt = ?T("Bytestream already activated"), Txt = ?T("Bytestream already activated"),
xmpp:make_error(IQ, xmpp:err_conflict(Txt, Lang)); xmpp:make_error(IQ, xmpp:err_conflict(Txt, Lang));
{error, Err} -> {error, Err} ->
?ERROR_MSG("failed to activate bytestream from ~s to ~s: ~p", ?ERROR_MSG("Failed to activate bytestream from ~s to ~s: ~p",
[Initiator, Target, Err]), [Initiator, Target, Err]),
Txt = ?T("Database failure"), Txt = ?T("Database failure"),
xmpp:make_error(IQ, xmpp:err_internal_server_error(Txt, Lang)) xmpp:make_error(IQ, xmpp:err_internal_server_error(Txt, Lang))

View File

@ -43,7 +43,7 @@ init() ->
{updated, _} -> {updated, _} ->
ok; ok;
Err -> Err ->
?ERROR_MSG("failed to clean 'proxy65' table: ~p", [Err]), ?ERROR_MSG("Failed to clean 'proxy65' table: ~p", [Err]),
Err Err
end. end.

View File

@ -239,7 +239,7 @@ stop(Host) ->
init([ServerHost, Opts]) -> init([ServerHost, Opts]) ->
process_flag(trap_exit, true), process_flag(trap_exit, true),
?DEBUG("pubsub init ~p ~p", [ServerHost, Opts]), ?DEBUG("Pubsub init ~p ~p", [ServerHost, Opts]),
Hosts = gen_mod:get_opt_hosts(Opts), Hosts = gen_mod:get_opt_hosts(Opts),
Access = mod_pubsub_opt:access_createnode(Opts), Access = mod_pubsub_opt:access_createnode(Opts),
PepOffline = mod_pubsub_opt:ignore_pep_from_offline(Opts), PepOffline = mod_pubsub_opt:ignore_pep_from_offline(Opts),
@ -3559,11 +3559,11 @@ tree_call({_User, Server, _Resource}, Function, Args) ->
tree_call(Server, Function, Args); tree_call(Server, Function, Args);
tree_call(Host, Function, Args) -> tree_call(Host, Function, Args) ->
Tree = tree(Host), Tree = tree(Host),
?DEBUG("tree_call apply(~s, ~s, ~p) @ ~s", [Tree, Function, Args, Host]), ?DEBUG("Tree_call apply(~s, ~s, ~p) @ ~s", [Tree, Function, Args, Host]),
apply(Tree, Function, Args). apply(Tree, Function, Args).
tree_action(Host, Function, Args) -> tree_action(Host, Function, Args) ->
?DEBUG("tree_action ~p ~p ~p", [Host, Function, Args]), ?DEBUG("Tree_action ~p ~p ~p", [Host, Function, Args]),
ServerHost = serverhost(Host), ServerHost = serverhost(Host),
Fun = fun () -> tree_call(Host, Function, Args) end, Fun = fun () -> tree_call(Host, Function, Args) end,
case mod_pubsub_opt:db_type(ServerHost) of case mod_pubsub_opt:db_type(ServerHost) of
@ -3574,7 +3574,7 @@ tree_action(Host, Function, Args) ->
{atomic, Result} -> {atomic, Result} ->
Result; Result;
{aborted, Reason} -> {aborted, Reason} ->
?ERROR_MSG("transaction return internal error: ~p~n", [{aborted, Reason}]), ?ERROR_MSG("Transaction return internal error: ~p~n", [{aborted, Reason}]),
ErrTxt = ?T("Database failure"), ErrTxt = ?T("Database failure"),
{error, xmpp:err_internal_server_error(ErrTxt, ejabberd_option:language())} {error, xmpp:err_internal_server_error(ErrTxt, ejabberd_option:language())}
end; end;
@ -3584,7 +3584,7 @@ tree_action(Host, Function, Args) ->
%% @doc <p>node plugin call.</p> %% @doc <p>node plugin call.</p>
node_call(Host, Type, Function, Args) -> node_call(Host, Type, Function, Args) ->
?DEBUG("node_call ~p ~p ~p", [Type, Function, Args]), ?DEBUG("Node_call ~p ~p ~p", [Type, Function, Args]),
Module = plugin(Host, Type), Module = plugin(Host, Type),
case apply(Module, Function, Args) of case apply(Module, Function, Args) of
{result, Result} -> {result, Result} ->
@ -3603,7 +3603,7 @@ node_call(Host, Type, Function, Args) ->
end. end.
node_action(Host, Type, Function, Args) -> node_action(Host, Type, Function, Args) ->
?DEBUG("node_action ~p ~p ~p ~p", [Host, Type, Function, Args]), ?DEBUG("Node_action ~p ~p ~p ~p", [Host, Type, Function, Args]),
transaction(Host, fun () -> transaction(Host, fun () ->
node_call(Host, Type, Function, Args) node_call(Host, Type, Function, Args)
end, end,
@ -3653,10 +3653,10 @@ do_transaction(ServerHost, Fun, Trans, DBType) ->
{atomic, {error, Error}} -> {atomic, {error, Error}} ->
{error, Error}; {error, Error};
{aborted, Reason} -> {aborted, Reason} ->
?ERROR_MSG("transaction return internal error: ~p~n", [{aborted, Reason}]), ?ERROR_MSG("Transaction return internal error: ~p~n", [{aborted, Reason}]),
{error, xmpp:err_internal_server_error(?T("Database failure"), ejabberd_option:language())}; {error, xmpp:err_internal_server_error(?T("Database failure"), ejabberd_option:language())};
Other -> Other ->
?ERROR_MSG("transaction return internal error: ~p~n", [Other]), ?ERROR_MSG("Transaction return internal error: ~p~n", [Other]),
{error, xmpp:err_internal_server_error(?T("Database failure"), ejabberd_option:language())} {error, xmpp:err_internal_server_error(?T("Database failure"), ejabberd_option:language())}
end. end.
@ -3833,7 +3833,7 @@ purge_offline(LJID) ->
end end
end, lists:usort(lists:flatten(Affs))); end, lists:usort(lists:flatten(Affs)));
{Error, _} -> {Error, _} ->
?ERROR_MSG("can not purge offline: ~p", [Error]) ?ERROR_MSG("Can not purge offline: ~p", [Error])
end. end.
-spec purge_offline(host(), ljid(), #pubsub_node{}) -> ok | {error, stanza_error()}. -spec purge_offline(host(), ljid(), #pubsub_node{}) -> ok | {error, stanza_error()}.

View File

@ -464,8 +464,7 @@ check_timeout(Source) ->
case mnesia:transaction(F) of case mnesia:transaction(F) of
{atomic, Res} -> Res; {atomic, Res} -> Res;
{aborted, Reason} -> {aborted, Reason} ->
?ERROR_MSG("mod_register: timeout check error: ~p~n", ?ERROR_MSG("timeout check error: ~p~n", [Reason]),
[Reason]),
true true
end; end;
true -> true true -> true
@ -499,7 +498,7 @@ remove_timeout(Source) ->
case mnesia:transaction(F) of case mnesia:transaction(F) of
{atomic, ok} -> ok; {atomic, ok} -> ok;
{aborted, Reason} -> {aborted, Reason} ->
?ERROR_MSG("mod_register: timeout remove error: " ?ERROR_MSG("Mod_register: timeout remove error: "
"~p~n", "~p~n",
[Reason]), [Reason]),
ok ok

View File

@ -178,7 +178,7 @@ css() ->
{ok, Data} -> {ok, Data} ->
{ok, Data}; {ok, Data};
{error, Why} -> {error, Why} ->
?ERROR_MSG("failed to read ~s: ~s", [File, file:format_error(Why)]), ?ERROR_MSG("Failed to read ~s: ~s", [File, file:format_error(Why)]),
error error
end. end.

View File

@ -321,7 +321,7 @@ process_iq_get(#iq{to = To, lang = Lang,
ver = Version} ver = Version}
end) end)
catch ?EX_RULE(E, R, St) -> catch ?EX_RULE(E, R, St) ->
?ERROR_MSG("failed to process roster get for ~s: ~p", ?ERROR_MSG("Failed to process roster get for ~s: ~p",
[jid:encode(To), {E, {R, ?EX_STACK(St)}}]), [jid:encode(To), {E, {R, ?EX_STACK(St)}}]),
Txt = ?T("Roster module has failed"), Txt = ?T("Roster module has failed"),
xmpp:make_error(IQ, xmpp:err_internal_server_error(Txt, Lang)) xmpp:make_error(IQ, xmpp:err_internal_server_error(Txt, Lang))
@ -446,7 +446,7 @@ process_iq_set(#iq{from = _From, to = To,
ok -> ok ->
xmpp:make_iq_result(IQ); xmpp:make_iq_result(IQ);
E -> E ->
?ERROR_MSG("roster set failed:~nIQ = ~s~nError = ~p", ?ERROR_MSG("Roster set failed:~nIQ = ~s~nError = ~p",
[xmpp:pp(IQ), E]), [xmpp:pp(IQ), E]),
xmpp:make_error(IQ, xmpp:err_internal_server_error()) xmpp:make_error(IQ, xmpp:err_internal_server_error())
end. end.

View File

@ -708,7 +708,7 @@ c2s_self_presence(Acc) ->
unset_presence(LUser, LServer, Resource, Status) -> unset_presence(LUser, LServer, Resource, Status) ->
Resources = ejabberd_sm:get_user_resources(LUser, Resources = ejabberd_sm:get_user_resources(LUser,
LServer), LServer),
?DEBUG("unset_presence for ~p @ ~p / ~p -> ~p " ?DEBUG("Unset_presence for ~p @ ~p / ~p -> ~p "
"(~p resources)", "(~p resources)",
[LUser, LServer, Resource, Status, length(Resources)]), [LUser, LServer, Resource, Status, length(Resources)]),
case length(Resources) of case length(Resources) of

View File

@ -286,7 +286,7 @@ check_auth(#sip{method = Method, hdrs = Hdrs, body = Body}, AuthHdr, _SIPSock) -
Password when is_binary(Password) -> Password when is_binary(Password) ->
esip:check_auth(Auth, Method, Body, Password); esip:check_auth(Auth, Method, Body, Password);
_ScramedPassword -> _ScramedPassword ->
?ERROR_MSG("unable to authenticate ~s@~s against SCRAM'ed " ?ERROR_MSG("Unable to authenticate ~s@~s against SCRAM'ed "
"password", [LUser, LServer]), "password", [LUser, LServer]),
false false
end; end;

View File

@ -80,7 +80,7 @@ request(#sip{hdrs = Hdrs} = Req, SIPSock) ->
[<<"*">>] when Expires == 0 -> [<<"*">>] when Expires == 0 ->
case unregister_session(US, CallID, CSeq) of case unregister_session(US, CallID, CSeq) of
{ok, ContactsWithExpires} -> {ok, ContactsWithExpires} ->
?INFO_MSG("unregister SIP session for user ~s@~s from ~s", ?INFO_MSG("Unregister SIP session for user ~s@~s from ~s",
[LUser, LServer, inet_parse:ntoa(PeerIP)]), [LUser, LServer, inet_parse:ntoa(PeerIP)]),
Cs = prepare_contacts_to_send(ContactsWithExpires), Cs = prepare_contacts_to_send(ContactsWithExpires),
mod_sip:make_response( mod_sip:make_response(
@ -223,7 +223,7 @@ handle_info({'DOWN', MRef, process, _Pid, _Reason}, State) ->
end, end,
{noreply, State}; {noreply, State};
handle_info(_Info, State) -> handle_info(_Info, State) ->
?ERROR_MSG("got unexpected info: ~p", [_Info]), ?ERROR_MSG("Unexpected info: ~p", [_Info]),
{noreply, State}. {noreply, State}.
terminate(_Reason, _State) -> terminate(_Reason, _State) ->

View File

@ -93,7 +93,7 @@ stop(Host) ->
reload(_Host, NewOpts, _OldOpts) -> reload(_Host, NewOpts, _OldOpts) ->
init_cache(NewOpts), init_cache(NewOpts),
?WARNING_MSG("module ~s is reloaded, but new configuration will take " ?WARNING_MSG("Module ~s is reloaded, but new configuration will take "
"effect for newly created client connections only", [?MODULE]). "effect for newly created client connections only", [?MODULE]).
depends(_Host, _Opts) -> depends(_Host, _Opts) ->

View File

@ -117,7 +117,7 @@ init([Host, Opts]) ->
process_local_iq_info), process_local_iq_info),
case Mod:is_search_supported(Host) of case Mod:is_search_supported(Host) of
false -> false ->
?WARNING_MSG("vcard search functionality is " ?WARNING_MSG("vCard search functionality is "
"not implemented for ~s backend", "not implemented for ~s backend",
[mod_vcard_opt:db_type(Opts)]); [mod_vcard_opt:db_type(Opts)]);
true -> true ->
@ -133,7 +133,7 @@ handle_call(_Call, _From, State) ->
{noreply, State}. {noreply, State}.
handle_cast(Cast, State) -> handle_cast(Cast, State) ->
?WARNING_MSG("unexpected cast: ~p", [Cast]), ?WARNING_MSG("Unexpected cast: ~p", [Cast]),
{noreply, State}. {noreply, State}.
handle_info({route, Packet}, State) -> handle_info({route, Packet}, State) ->
@ -143,7 +143,7 @@ handle_info({route, Packet}, State) ->
end, end,
{noreply, State}; {noreply, State};
handle_info(Info, State) -> handle_info(Info, State) ->
?WARNING_MSG("unexpected info: ~p", [Info]), ?WARNING_MSG("Unexpected info: ~p", [Info]),
{noreply, State}. {noreply, State}.
terminate(_Reason, #state{hosts = MyHosts, server_host = Host}) -> terminate(_Reason, #state{hosts = MyHosts, server_host = Host}) ->

View File

@ -55,7 +55,7 @@ from_dir(ProsodyDir) ->
"privacy", "pep", "pubsub"]) "privacy", "pep", "pubsub"])
end, HostDirs); end, HostDirs);
{error, Why} = Err -> {error, Why} = Err ->
?ERROR_MSG("failed to list ~s: ~s", ?ERROR_MSG("Failed to list ~s: ~s",
[ProsodyDir, file:format_error(Why)]), [ProsodyDir, file:format_error(Why)]),
Err Err
end; end;
@ -97,7 +97,7 @@ convert_dir(Path, Host, Type) ->
{error, enoent} -> {error, enoent} ->
ok; ok;
{error, Why} = Err -> {error, Why} = Err ->
?ERROR_MSG("failed to list ~s: ~s", ?ERROR_MSG("Failed to list ~s: ~s",
[Path, file:format_error(Why)]), [Path, file:format_error(Why)]),
Err Err
end. end.
@ -119,11 +119,11 @@ eval_file(Path) ->
{ok, _} = Res -> {ok, _} = Res ->
Res; Res;
{error, Why} = Err -> {error, Why} = Err ->
?ERROR_MSG("failed to eval ~s: ~p", [Path, Why]), ?ERROR_MSG("Failed to eval ~s: ~p", [Path, Why]),
Err Err
end; end;
{error, Why} = Err -> {error, Why} = Err ->
?ERROR_MSG("failed to read file ~s: ~s", ?ERROR_MSG("Failed to read file ~s: ~s",
[Path, file:format_error(Why)]), [Path, file:format_error(Why)]),
Err Err
end. end.
@ -151,7 +151,7 @@ convert_data(Host, "accounts", User, [Data]) ->
ok -> ok ->
ok; ok;
Err -> Err ->
?ERROR_MSG("failed to register user ~s@~s: ~p", ?ERROR_MSG("Failed to register user ~s@~s: ~p",
[User, Host, Err]), [User, Host, Err]),
Err Err
end; end;
@ -272,12 +272,12 @@ convert_data(HostStr, "pubsub", Node, [Data]) ->
Error Error
end; end;
Error -> Error ->
?ERROR_MSG("failed to import pubsub node ~s on ~p:~n~p", ?ERROR_MSG("Failed to import pubsub node ~s on ~p:~n~p",
[Node, Host, NodeData]), [Node, Host, NodeData]),
Error Error
end; end;
Error -> Error ->
?ERROR_MSG("failed to import pubsub node: ~p", [Error]), ?ERROR_MSG("Failed to import pubsub node: ~p", [Error]),
Error Error
end; end;
convert_data(_Host, _Type, _User, _Data) -> convert_data(_Host, _Type, _User, _Data) ->