]> granicus.if.org Git - ejabberd/commitdiff
Rewrite io:format calls to loglevel macros (EJAB-555) so we do not loose debug anymor...
authorChristophe Romain <christophe.romain@process-one.net>
Fri, 21 Mar 2008 15:00:59 +0000 (15:00 +0000)
committerChristophe Romain <christophe.romain@process-one.net>
Fri, 21 Mar 2008 15:00:59 +0000 (15:00 +0000)
SVN Revision: 1240

14 files changed:
ChangeLog
src/cyrsasl_digest.erl
src/ejabberd.hrl
src/ejabberd_auth.erl
src/ejabberd_ctl.erl
src/ejabberd_loglevel.erl
src/ejabberd_s2s.erl
src/ejabberd_sm.erl
src/ejabberd_update.erl
src/extauth.erl
src/mod_irc/mod_irc.erl
src/shaper.erl
src/tls/tls.erl
src/web/ejabberd_http_poll.erl

index f20db164fd717fe16f887736ae25eefbadaf3fc1..52807ceb887f6b4a817b2ed4c84042a2338353d6 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,22 @@
+2008-03-21  Badlop  <badlop@process-one.net>
+
+       * src/cyrsasl_digest.erl: Rewrite io:format calls to loglevel
+       macros (EJAB-555)
+       * src/ejabberd_auth.erl: Likewise
+       * src/ejabberd_ctl.erl: Likewise
+       * src/ejabberd_loglevel.erl: Likewise
+       * src/ejabberd_s2s.erl: Likewise
+       * src/ejabberd_sm.erl: Likewise
+       * src/ejabberd_update.erl: Likewise
+       * src/extauth.erl: Likewise
+       * src/mod_irc/mod_irc.erl: Likewise
+       * src/shaper.erl: Likewise
+       * src/tls/tls.erl: Likewise
+       * src/web/ejabberd_http_poll.erl: Likewise
+
+       * src/ejabberd.hrl: New macro ?PRINT(Format, Args) to print in
+       standard output
+
 2008-03-20  Badlop  <badlop@process-one.net>
 
        * doc/guide.tex: Improve explanation of how to start ejabberd when
index 1dfd54931de914ab3191e253c4423826bb6c089d..3ce8f8e6f0d0736bb10660b26da5c491b1e1e7d6 100644 (file)
@@ -14,6 +14,8 @@
         mech_new/3,
         mech_step/2]).
 
+-include("ejabberd.hrl").
+
 -behaviour(cyrsasl).
 
 -record(state, {step, nonce, username, authzid, get_password}).
@@ -67,7 +69,7 @@ mech_step(#state{step = 5,
                 authzid = AuthzId}, "") ->
     {ok, [{username, UserName}, {authzid, AuthzId}]};
 mech_step(A, B) ->
-    io:format("SASL DIGEST: A ~p B ~p", [A,B]),
+    ?DEBUG("SASL DIGEST: A ~p B ~p", [A,B]),
     {error, "bad-protocol"}.
 
 
index c3b7deab89975b9ec958808c404022a958526729..89791639ef64abde49cc99c13e076fcf689c830b 100644 (file)
 %% ---------------------------------
 %% Logging mechanism
 
+%% Print in standard output
+-define(PRINT(Format, Args),
+    io:format(Format, Args)).
+
 -define(DEBUG(Format, Args),
     ejabberd_logger:debug_msg(?MODULE,?LINE,Format, Args)).
 
index ba351232727efd012b6237743e5da8b47e2cf33b..d11f8094fb9be8d9b345b20269711a5f7c669c72 100644 (file)
@@ -206,7 +206,7 @@ ctl_process_get_registered(_Val, Host, ["registered-users"]) ->
     NewLine = io_lib:format("~n", []),
     SUsers = lists:sort(Users),
     FUsers = lists:map(fun({U, _S}) -> [U, NewLine] end, SUsers),
-    io:format("~s", [FUsers]),
+    ?PRINT("~s", [FUsers]),
     {stop, ?STATUS_SUCCESS};
 ctl_process_get_registered(Val, _Host, _Args) ->
     Val.
index df882d50f915868a0a81726e30be01cd9e3e28bb..e5be354263759df8e2dffe68bd5d4284df3caab3 100644 (file)
@@ -58,7 +58,7 @@ start() ->
            Node = list_to_atom(SNode1),
            Status = case rpc:call(Node, ?MODULE, process, [Args]) of
                         {badrpc, Reason} ->
-                            io:format("RPC failed on the node ~p: ~p~n",
+                            ?PRINT("RPC failed on the node ~p: ~p~n",
                                       [Node, Reason]),
                             ?STATUS_BADRPC;
                         S ->
@@ -77,14 +77,14 @@ init() ->
 
 process(["status"]) ->
     {InternalStatus, ProvidedStatus} = init:get_status(),
-    io:format("Node ~p is ~p. Status: ~p~n",
+    ?PRINT("Node ~p is ~p. Status: ~p~n",
               [node(), InternalStatus, ProvidedStatus]),
     case lists:keysearch(ejabberd, 1, application:which_applications()) of
         false ->
-            io:format("ejabberd is not running~n", []),
+            ?PRINT("ejabberd is not running~n", []),
             ?STATUS_ERROR;
         {value,_Version} ->
-            io:format("ejabberd is running~n", []),
+            ?PRINT("ejabberd is running~n", []),
             ?STATUS_SUCCESS
     end;
 
@@ -105,11 +105,11 @@ process(["register", User, Server, Password]) ->
        {atomic, ok} ->
            ?STATUS_SUCCESS;
        {atomic, exists} ->
-           io:format("User ~p already registered at node ~p~n",
+           ?PRINT("User ~p already registered at node ~p~n",
                      [User ++ "@" ++ Server, node()]),
            ?STATUS_ERROR;
        {error, Reason} ->
-           io:format("Can't register user ~p at node ~p: ~p~n",
+           ?PRINT("Can't register user ~p at node ~p: ~p~n",
                      [User ++ "@" ++ Server, node(), Reason]),
            ?STATUS_ERROR
     end;
@@ -117,7 +117,7 @@ process(["register", User, Server, Password]) ->
 process(["unregister", User, Server]) ->
     case ejabberd_auth:remove_user(User, Server) of
        {error, Reason} ->
-           io:format("Can't unregister user ~p at node ~p: ~p~n",
+           ?PRINT("Can't unregister user ~p at node ~p: ~p~n",
                      [User ++ "@" ++ Server, node(), Reason]),
            ?STATUS_ERROR;
        _ ->
@@ -129,7 +129,7 @@ process(["backup", Path]) ->
         ok ->
            ?STATUS_SUCCESS;
        {error, Reason} ->
-           io:format("Can't store backup in ~p at node ~p: ~p~n",
+           ?PRINT("Can't store backup in ~p at node ~p: ~p~n",
                      [filename:absname(Path), node(), Reason]),
            ?STATUS_ERROR
     end;
@@ -139,7 +139,7 @@ process(["dump", Path]) ->
        ok ->
            ?STATUS_SUCCESS;
        {error, Reason} ->
-            io:format("Can't store dump in ~p at node ~p: ~p~n",
+            ?PRINT("Can't store dump in ~p at node ~p: ~p~n",
                       [filename:absname(Path), node(), Reason]),
            ?STATUS_ERROR
     end;
@@ -149,7 +149,7 @@ process(["load", Path]) ->
         {atomic, ok} ->
             ?STATUS_SUCCESS;
         {error, Reason} ->
-            io:format("Can't load dump in ~p at node ~p: ~p~n",
+            ?PRINT("Can't load dump in ~p at node ~p: ~p~n",
                       [filename:absname(Path), node(), Reason]),
            ?STATUS_ERROR
     end;
@@ -159,15 +159,15 @@ process(["restore", Path]) ->
        {atomic, _} ->
            ?STATUS_SUCCESS;
        {error, Reason} ->
-           io:format("Can't restore backup from ~p at node ~p: ~p~n",
+           ?PRINT("Can't restore backup from ~p at node ~p: ~p~n",
                      [filename:absname(Path), node(), Reason]),
            ?STATUS_ERROR;
        {aborted,{no_exists,Table}} ->
-           io:format("Can't restore backup from ~p at node ~p: Table ~p does not exist.~n",
+           ?PRINT("Can't restore backup from ~p at node ~p: Table ~p does not exist.~n",
                      [filename:absname(Path), node(), Table]),
            ?STATUS_ERROR;
        {aborted,enoent} ->
-           io:format("Can't restore backup from ~p at node ~p: File not found.~n",
+           ?PRINT("Can't restore backup from ~p at node ~p: File not found.~n",
                      [filename:absname(Path), node()]),
            ?STATUS_ERROR
     end;
@@ -177,7 +177,7 @@ process(["install-fallback", Path]) ->
        ok ->
            ?STATUS_SUCCESS;
        {error, Reason} ->
-           io:format("Can't install fallback from ~p at node ~p: ~p~n",
+           ?PRINT("Can't install fallback from ~p at node ~p: ~p~n",
                      [filename:absname(Path), node(), Reason]),
            ?STATUS_ERROR
     end;
@@ -187,7 +187,7 @@ process(["import-file", Path]) ->
         ok ->
             ?STATUS_SUCCESS;
         {error, Reason} ->
-            io:format("Can't import jabberd 1.4 spool file ~p at node ~p: ~p~n",
+            ?PRINT("Can't import jabberd 1.4 spool file ~p at node ~p: ~p~n",
                       [filename:absname(Path), node(), Reason]),
            ?STATUS_ERROR
     end;
@@ -197,7 +197,7 @@ process(["import-dir", Path]) ->
         ok ->
             ?STATUS_SUCCESS;
         {error, Reason} ->
-            io:format("Can't import jabberd 1.4 spool dir ~p at node ~p: ~p~n",
+            ?PRINT("Can't import jabberd 1.4 spool dir ~p at node ~p: ~p~n",
                       [filename:absname(Path), node(), Reason]),
            ?STATUS_ERROR
     end;
@@ -207,7 +207,7 @@ process(["delete-expired-messages"]) ->
     ?STATUS_SUCCESS;
 
 process(["mnesia"]) ->
-    io:format("~p~n", [mnesia:system_info(all)]),
+    ?PRINT("~p~n", [mnesia:system_info(all)]),
     ?STATUS_SUCCESS;
 
 process(["mnesia", "info"]) ->
@@ -216,30 +216,30 @@ process(["mnesia", "info"]) ->
 
 process(["mnesia", Arg]) when is_list(Arg) ->
     case catch mnesia:system_info(list_to_atom(Arg)) of
-       {'EXIT', Error} -> io:format("Error: ~p~n", [Error]);
-       Return -> io:format("~p~n", [Return])
+       {'EXIT', Error} -> ?PRINT("Error: ~p~n", [Error]);
+       Return -> ?PRINT("~p~n", [Return])
     end,
     ?STATUS_SUCCESS;
 
 process(["delete-old-messages", Days]) ->
     case catch list_to_integer(Days) of
        {'EXIT',{Reason, _Stack}} ->
-            io:format("Can't delete old messages (~p). Please pass an integer as parameter.~n",
+            ?PRINT("Can't delete old messages (~p). Please pass an integer as parameter.~n",
                       [Reason]),
            ?STATUS_ERROR;
        Integer when Integer >= 0 ->
            {atomic, _} = mod_offline:remove_old_messages(Integer),
-           io:format("Removed messages older than ~s days~n", [Days]),
+           ?PRINT("Removed messages older than ~s days~n", [Days]),
            ?STATUS_SUCCESS;
        _Integer ->
-           io:format("Can't delete old messages. Please pass a positive integer as parameter.~n", []),
+           ?PRINT("Can't delete old messages. Please pass a positive integer as parameter.~n", []),
            ?STATUS_ERROR
     end;
 
 process(["vhost", H | Args]) ->
     case jlib:nameprep(H) of
        false ->
-           io:format("Bad hostname: ~p~n", [H]),
+           ?PRINT("Bad hostname: ~p~n", [H]),
            ?STATUS_ERROR;
        Host ->
            case ejabberd_hooks:run_fold(
@@ -294,7 +294,7 @@ print_usage() ->
                  ["  ", Cmd, string:chars($\s, MaxCmdLen - length(Cmd) + 2),
                   Desc, NewLine]
          end, CmdDescs),
-    io:format(
+    ?PRINT(
       "Usage: ejabberdctl [--node nodename] command [options]~n"
       "~n"
       "Available commands in this ejabberd node:~n"
@@ -303,8 +303,8 @@ print_usage() ->
       "Examples:~n"
       "  ejabberdctl restart~n"
       "  ejabberdctl --node ejabberd@host restart~n"
-      "  ejabberdctl vhost jabber.example.org ...~n"
-     ).
+      "  ejabberdctl vhost jabber.example.org ...~n",
+     []).
 
 print_vhost_usage(Host) ->
     CmdDescs =
@@ -327,15 +327,15 @@ print_vhost_usage(Host) ->
                  ["  ", Cmd, string:chars($\s, MaxCmdLen - length(Cmd) + 2),
                   Desc, NewLine]
          end, CmdDescs),
-    io:format(
+    ?PRINT(
       "Usage: ejabberdctl [--node nodename] vhost hostname command [options]~n"
       "~n"
       "Available commands in this ejabberd node and this vhost:~n"
       ++ FmtCmdDescs ++
       "~n"
       "Examples:~n"
-      "  ejabberdctl vhost "++Host++" registered-users~n"
-     ).
+      "  ejabberdctl vhost "++Host++" registered-users~n",
+     []).
 
 register_commands(CmdDescs, Module, Function) ->
     ets:insert(ejabberd_ctl_cmds, CmdDescs),
index 88de26a4121a94a2e4ab576a966718b219a3629b..0f482b6fe8c7390954a60709f0a0cc804c1b114d 100644 (file)
@@ -33,6 +33,8 @@
 
 -export([set/1]).
 
+-include("ejabberd.hrl").
+
 -define(LOGMODULE, "error_logger").
 
 %% Error levels:
@@ -80,7 +82,7 @@ load_logger(Forms, Mod, Loglevel) ->
         {ok, M, Bin} ->
             code:load_binary(M, Fname, Bin);
         Error ->
-            io:format("Error ~p~n", [Error])
+            ?CRITICAL_MSG("Error ~p~n", [Error])
     end.
 
 %% --------------------------------------------------------------
index eebee741be6e8af8b063250159e892d216d0bfd6..c72af5aecae411d157a61404521d24d789cb4be0 100644 (file)
@@ -415,11 +415,11 @@ send_element(Pid, El) ->
 
 ctl_process(_Val, ["incoming-s2s-number"]) ->
     N = length(supervisor:which_children(ejabberd_s2s_in_sup)),
-    io:format("~p~n", [N]),
+    ?PRINT("~p~n", [N]),
     {stop, ?STATUS_SUCCESS};
 ctl_process(_Val, ["outgoing-s2s-number"]) ->
     N = length(supervisor:which_children(ejabberd_s2s_out_sup)),
-    io:format("~p~n", [N]),
+    ?PRINT("~p~n", [N]),
     {stop, ?STATUS_SUCCESS};
 ctl_process(Val, _Args) ->
     Val.
index 3d34f2514a08d8b896b0f9ce57c4a4b8845d7a5a..2d4b7c5b970ec097a66704a3c32f9d782d08c654 100644 (file)
@@ -652,18 +652,18 @@ ctl_process(_Val, ["connected-users"]) ->
     NewLine = io_lib:format("~n", []),
     SUSRs = lists:sort(USRs),
     FUSRs = lists:map(fun({U, S, R}) -> [U, $@, S, $/, R, NewLine] end, SUSRs),
-    io:format("~s", [FUSRs]),
+    ?PRINT("~s", [FUSRs]),
     {stop, ?STATUS_SUCCESS};
 ctl_process(_Val, ["connected-users-number"]) ->
     N = length(dirty_get_sessions_list()),
-    io:format("~p~n", [N]),
+    ?PRINT("~p~n", [N]),
     {stop, ?STATUS_SUCCESS};
 ctl_process(_Val, ["user-resources", User, Server]) ->
     Resources =  get_user_resources(User, Server),
     NewLine = io_lib:format("~n", []),
     SResources = lists:sort(Resources),
     FResources = lists:map(fun(R) -> [R, NewLine] end, SResources),
-    io:format("~s", [FResources]),
+    ?PRINT("~s", [FResources]),
     {stop, ?STATUS_SUCCESS};
 ctl_process(Val, _Args) ->
     Val.
index ef3c4a47a8dfeec43cb5d432b18df5826a982e08..3f878337c8ce36535b48916e8cf7d6fff60314d5 100644 (file)
@@ -30,6 +30,8 @@
 %% API
 -export([update/0, update_info/0]).
 
+-include("ejabberd.hrl").
+
 %%====================================================================
 %% API
 %%====================================================================
@@ -40,7 +42,7 @@ update() ->
                release_handler_1:eval_script(
                  LowLevelScript, [],
                  [{ejabberd, "", filename:join(Dir, "..")}]),
-           io:format("eval: ~p~n", [Eval]),
+           ?INFO_MSG("eval: ~p~n", [Eval]),
            Eval;
        {error, Reason} ->
            {error, Reason}
@@ -67,16 +69,16 @@ update_info() ->
                                  false
                          end
                  end, Beams),
-           io:format("beam files: ~p~n", [UpdatedBeams]),
+           ?INFO_MSG("beam files: ~p~n", [UpdatedBeams]),
            Script = make_script(UpdatedBeams),
-           io:format("script: ~p~n", [Script]),
+           ?INFO_MSG("script: ~p~n", [Script]),
            LowLevelScript = make_low_level_script(UpdatedBeams, Script),
-           io:format("low level script: ~p~n", [LowLevelScript]),
+           ?INFO_MSG("low level script: ~p~n", [LowLevelScript]),
            Check =
                release_handler_1:check_script(
                  LowLevelScript,
                  [{ejabberd, "", filename:join(Dir, "..")}]),
-           io:format("check: ~p~n", [Check]),
+           ?INFO_MSG("check: ~p~n", [Check]),
            {ok, Dir, UpdatedBeams, Script, LowLevelScript, Check};
        {error, Reason} ->
            {error, Reason}
index b84546d4e5f231c2a87d81a35f389ae598a9b40d..052e95d7ae58b92c4ca20492557c857ab15a5326 100644 (file)
@@ -30,6 +30,7 @@
 -export([start/2, stop/1, init/2,
         check_password/3, set_password/3, is_user_exists/2]).
 
+-include("ejabberd.hrl").
 
 start(Host, ExtPrg) ->
     spawn(?MODULE, init, [Host, ExtPrg]).
@@ -76,7 +77,7 @@ loop(Port) ->
                    exit(normal)
            end;
        {'EXIT', Port, Reason} ->
-           io:format("~p ~n", [Reason]),
+           ?CRITICAL_MSG("~p ~n", [Reason]),
            exit(port_terminated)
     end.
 
index e1d069f7442937ddf66ac4c00db233781fdde5a1..4b2ae6adf53ff10d6737ed6beab6b884c0e24060 100644 (file)
@@ -254,7 +254,7 @@ do_route1(Host, ServerHost, From, To, Packet, DefEnc) ->
                [[_ | _] = Channel, [_ | _] = Server] ->
                    case ets:lookup(irc_connection, {From, Server, Host}) of
                        [] ->
-                           io:format("open new connection~n"),
+                           ?DEBUG("open new connection~n", []),
                            {Username, Encoding} = get_user_and_encoding(
                                                     Host, From, Server, DefEnc),
                            {ok, Pid} = mod_irc_connection:start(
@@ -269,7 +269,7 @@ do_route1(Host, ServerHost, From, To, Packet, DefEnc) ->
                            ok;
                        [R] ->
                            Pid = R#irc_connection.pid,
-                           io:format("send to process ~p~n",
+                           ?DEBUG("send to process ~p~n",
                                      [Pid]),
                            mod_irc_connection:route_chan(
                              Pid, Channel, Resource, Packet),
@@ -285,7 +285,7 @@ do_route1(Host, ServerHost, From, To, Packet, DefEnc) ->
                                    ejabberd_router:route(To, From, Err);
                                [R] ->
                                    Pid = R#irc_connection.pid,
-                                   io:format("send to process ~p~n",
+                                   ?DEBUG("send to process ~p~n",
                                              [Pid]),
                                    mod_irc_connection:route_nick(
                                      Pid, Nick, Packet),
index 11317754740e84fc4a6de18582ca848bf635ab08..0bede187d76eaf7cf42665d46d54bbbc59888c60 100644 (file)
@@ -29,6 +29,8 @@
 
 -export([new/1, new1/1, update/2]).
 
+-include("ejabberd.hrl").
+
 -record(maxrate, {maxrate, lastrate, lasttime}).
 
 
@@ -56,8 +58,8 @@ update(#maxrate{} = State, Size) ->
     MinInterv = 1000 * Size /
        (2 * State#maxrate.maxrate - State#maxrate.lastrate),
     Interv = (now_to_usec(now()) - State#maxrate.lasttime) / 1000,
-    %io:format("State: ~p, Size=~p~nM=~p, I=~p~n",
-    %          [State, Size, MinInterv, Interv]),
+    ?INFO_MSG("State: ~p, Size=~p~nM=~p, I=~p~n",
+              [State, Size, MinInterv, Interv]),
     Pause = if
                MinInterv > Interv ->
                    1 + trunc(MinInterv - Interv);
index aeeebaacc45d4fbdfd4d97f9735108aaafabc177..b3b84a4ce7fa45e58f8caf8639c5369de783c27c 100644 (file)
@@ -49,6 +49,8 @@
         code_change/3,
         terminate/2]).
 
+-include("ejabberd.hrl").
+
 -define(SET_CERTIFICATE_FILE_ACCEPT, 1).
 -define(SET_CERTIFICATE_FILE_CONNECT, 2).
 -define(SET_ENCRYPTED_INPUT,  3).
@@ -158,7 +160,7 @@ recv_data(#tlssock{tcpsock = TCPSocket, tlsport = Port}, Packet) ->
                        <<0, Out/binary>> ->
                            case gen_tcp:send(TCPSocket, Out) of
                                ok ->
-                                   %io:format("IN: ~p~n", [{TCPSocket, binary_to_list(In)}]),
+                                   %?PRINT("IN: ~p~n", [{TCPSocket, binary_to_list(In)}]),
                                    {ok, In};
                                Error ->
                                    Error
@@ -176,7 +178,7 @@ recv_data(#tlssock{tcpsock = TCPSocket, tlsport = Port}, Packet) ->
 send(#tlssock{tcpsock = TCPSocket, tlsport = Port}, Packet) ->
     case port_control(Port, ?SET_DECRYPTED_OUTPUT, Packet) of
        <<0>> ->
-           %io:format("OUT: ~p~n", [{TCPSocket, lists:flatten(Packet)}]),
+           %?PRINT("OUT: ~p~n", [{TCPSocket, lists:flatten(Packet)}]),
            case port_control(Port, ?GET_ENCRYPTED_OUTPUT, []) of
                <<0, Out/binary>> ->
                    gen_tcp:send(TCPSocket, Out);
@@ -235,50 +237,50 @@ test() ->
        {error, already_loaded} -> ok
     end,
     Port = open_port({spawn, tls_drv}, [binary]),
-    io:format("open_port: ~p~n", [Port]),
+    ?PRINT("open_port: ~p~n", [Port]),
     PCRes = port_control(Port, ?SET_CERTIFICATE_FILE_ACCEPT,
                         "./ssl.pem" ++ [0]),
-    io:format("port_control: ~p~n", [PCRes]),
+    ?PRINT("port_control: ~p~n", [PCRes]),
     {ok, ListenSocket} = gen_tcp:listen(1234, [binary,
                                               {packet, 0}, 
                                               {active, true},
                                               {reuseaddr, true},
                                               {nodelay, true}]),
-    io:format("listen: ~p~n", [ListenSocket]),
+    ?PRINT("listen: ~p~n", [ListenSocket]),
     {ok, Socket} = gen_tcp:accept(ListenSocket),
-    io:format("accept: ~p~n", [Socket]),
+    ?PRINT("accept: ~p~n", [Socket]),
     loop(Port, Socket).
 
 
 loop(Port, Socket) ->
     receive
        {tcp, Socket, Data} ->
-           %io:format("read: ~p~n", [Data]),
+           %?PRINT("read: ~p~n", [Data]),
            Res = port_control(Port, ?SET_ENCRYPTED_INPUT, Data),
-           io:format("SET_ENCRYPTED_INPUT: ~p~n", [Res]),
+           ?PRINT("SET_ENCRYPTED_INPUT: ~p~n", [Res]),
 
            DIRes = port_control(Port, ?GET_DECRYPTED_INPUT, Data),
-           io:format("GET_DECRYPTED_INPUT: ~p~n", [DIRes]),
+           ?PRINT("GET_DECRYPTED_INPUT: ~p~n", [DIRes]),
            case DIRes of
                <<0, In/binary>> ->
-                   io:format("input: ~s~n", [binary_to_list(In)]);
+                   ?PRINT("input: ~s~n", [binary_to_list(In)]);
                <<1, DIError/binary>> ->
-                   io:format("GET_DECRYPTED_INPUT error: ~p~n", [binary_to_list(DIError)])
+                   ?PRINT("GET_DECRYPTED_INPUT error: ~p~n", [binary_to_list(DIError)])
            end,
 
            EORes = port_control(Port, ?GET_ENCRYPTED_OUTPUT, Data),
-           io:format("GET_ENCRYPTED_OUTPUT: ~p~n", [EORes]),
+           ?PRINT("GET_ENCRYPTED_OUTPUT: ~p~n", [EORes]),
            case EORes of
                <<0, Out/binary>> ->
                    gen_tcp:send(Socket, Out);
                <<1, EOError/binary>> ->
-                   io:format("GET_ENCRYPTED_OUTPUT error: ~p~n", [binary_to_list(EOError)])
+                   ?PRINT("GET_ENCRYPTED_OUTPUT error: ~p~n", [binary_to_list(EOError)])
            end,
                    
 
            loop(Port, Socket);
        Msg ->
-           io:format("receive: ~p~n", [Msg]),
+           ?PRINT("receive: ~p~n", [Msg]),
            loop(Port, Socket)
     end.
 
index 281a2aea6d79306fcb07c5977add7f3a3a634e21..081dda83cc8f3baced1160fd5e85a457216fff30 100644 (file)
@@ -398,7 +398,7 @@ resend_message(Packet) ->
     ParsedPacket = xml_stream:parse_element(Packet),
     From = get_jid("from", ParsedPacket),
     To = get_jid("to", ParsedPacket),
-    io:format("MREMOND: Resend ~p ~p ~p~n",[From,To, ParsedPacket]),
+    ?DEBUG("Resend ~p ~p ~p~n",[From,To, ParsedPacket]),
     ejabberd_router:route(From, To, ParsedPacket).
 
 %% Type can be "from" or "to"