Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

clean up internal logging

  • Loading branch information...
commit b6b8921759982e62d555e6c77c9d86d87554d271 1 parent 75da94d
Tom Preston-Werner authored
Showing with 9 additions and 12 deletions.
  1. +0 −2  elibs/receive_pack.erl
  2. +9 −10 elibs/server.erl
2  elibs/receive_pack.erl
View
@@ -2,7 +2,5 @@
-export([handle/3]).
handle(Sock, _Host, _Header) ->
- io:format("receive-pack~n"),
gen_tcp:send(Sock, "006d\n*********'\n\nYou can't push to git://github.com/user/repo.git\nUse git@github.com:user/repo.git\n\n*********"),
- io:format("sent~n"),
ok = gen_tcp:close(Sock).
19 elibs/server.erl
View
@@ -15,7 +15,7 @@ init(Parent) ->
read_conf() ->
{ok, Conf} = application:get_env(conf),
- io:format("Using conf file ~p~n", [Conf]),
+ error_logger:info_msg("Using conf file ~p~n", [Conf]),
conf:read_conf(Conf).
init_log() ->
@@ -26,15 +26,15 @@ init_log(undefined) ->
ok.
try_listen(0) ->
- io:format("Could not listen on port 9418~n");
+ error_logger:info_msg("Could not listen on port 9418~n");
try_listen(Times) ->
Res = gen_tcp:listen(9418, [list, {packet, 0}, {active, false}]),
case Res of
{ok, LSock} ->
- io:format("Listening on port 9418~n"),
+ error_logger:info_msg("Listening on port 9418~n"),
LSock;
{error, Reason} ->
- io:format("Could not listen on port 9418: ~p~n", [Reason]),
+ error_logger:info_msg("Could not listen on port 9418: ~p~n", [Reason]),
timer:sleep(5000),
try_listen(Times - 1)
end.
@@ -128,18 +128,18 @@ handle_upload_pack_impl(Sock, Host, Header) ->
port_close(Port),
ok;
{error, Reason} ->
- io:format("Client closed socket because: ~p~n", [Reason]),
+ error_logger:error_msg("Client closed socket because: ~p~n", [Reason]),
port_command(Port, "0000"),
port_close(Port),
ok = gen_tcp:close(Sock)
end.
handle_upload_pack_nosuchrepo(Sock, Repo) ->
- io:format("no such repo: ~p~n", [Repo]),
+ error_logger:info_msg("no such repo: ~p~n", [Repo]),
ok = gen_tcp:close(Sock).
handle_upload_pack_permission_denied(Sock, Repo) ->
- io:format("permission denied to repo: ~p~n", [Repo]),
+ error_logger:info_msg("permission denied to repo: ~p~n", [Repo]),
ok = gen_tcp:close(Sock).
gather_demand(Sock) ->
@@ -228,10 +228,10 @@ readline(Port) ->
% io:format("readline = ~p~n", [Data]),
{data, Data};
Msg ->
- io:format("unknown message ~p~n", [Msg]),
+ error_logger:error_msg("unknown message ~p~n", [Msg]),
{error, Msg}
after 15000 ->
- io:format("timed out waiting for port~n"),
+ error_logger:error_msg("timed out waiting for port~n"),
{error, timeout}
end.
@@ -240,7 +240,6 @@ log_initial_clone(Demand, Host, Path) ->
{match ,_Start, _Length} ->
ok;
_Else ->
- io:format("initial clone: ~p, ~p~n", [Host, Path]),
ok = log:write("clone", [Host, Path])
end.
Please sign in to comment.
Something went wrong with that request. Please try again.