You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ro...@apache.org on 2015/06/24 15:39:14 UTC

[3/3] couchdb-setup git commit: use couch_log instead of io:format

use couch_log instead of io:format

PR: #2
PR-URL: https://github.com/apache/couchdb-setup/pull/2
Reviewed-By: Jan Lehnardt <ja...@apache.org>
Reviewed-By: Alexander Shorin <kx...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/couchdb-setup/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-setup/commit/aa17a557
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-setup/tree/aa17a557
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-setup/diff/aa17a557

Branch: refs/heads/master
Commit: aa17a557bb6ad207c1d4e42d0e74ef81f1d45f2c
Parents: f4fd3fa
Author: Robert Kowalski <ro...@apache.org>
Authored: Tue Jun 23 11:42:12 2015 +0200
Committer: Robert Kowalski <ro...@apache.org>
Committed: Wed Jun 24 15:38:30 2015 +0200

----------------------------------------------------------------------
 src/setup.erl       |  8 ++++----
 src/setup_httpd.erl | 16 ++++++++--------
 2 files changed, 12 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-setup/blob/aa17a557/src/setup.erl
----------------------------------------------------------------------
diff --git a/src/setup.erl b/src/setup.erl
index b227856..2118349 100644
--- a/src/setup.erl
+++ b/src/setup.erl
@@ -99,7 +99,7 @@ enable_cluster_http(Options) ->
         {ok, "201", _, _} ->
             ok;
         Else ->
-            io:format("~nsend_req: ~p~n", [Else]),
+            couch_log:notice("send_req: ~p~n", [Else]),
             {error, Else}
     end.
 
@@ -141,7 +141,7 @@ enable_cluster_int(Options, no) ->
         Port ->
             config:set("httpd", "port", integer_to_list(Port))
     end,
-    io:format("~nEnable Cluster: ~p~n", [Options]).
+    couch_log:notice("Enable Cluster: ~p~n", [Options]).
     %cluster_state:set(enabled).
 
 maybe_set_admin(Username, Password) ->
@@ -168,7 +168,7 @@ add_node(Options) ->
 add_node_int(_Options, no) ->
     {error, cluster_not_enabled};
 add_node_int(Options, ok) ->
-    io:format("~nadd node: ~p~n", [Options]),
+    couch_log:notice("add node: ~p~n", [Options]),
     ErlangCookie = erlang:get_cookie(),
 
     % POST to nodeB/_setup
@@ -198,7 +198,7 @@ add_node_int(Options, ok) ->
             % when done, PUT :5986/nodes/nodeB
             create_node_doc(Host, Port);
         Else ->
-            io:format("~nsend_req: ~p~n", [Else]),
+            couch_log:notice("send_req: ~p~n", [Else]),
             Else
     end.
 

http://git-wip-us.apache.org/repos/asf/couchdb-setup/blob/aa17a557/src/setup_httpd.erl
----------------------------------------------------------------------
diff --git a/src/setup_httpd.erl b/src/setup_httpd.erl
index de1bff5..f84112b 100644
--- a/src/setup_httpd.erl
+++ b/src/setup_httpd.erl
@@ -19,7 +19,7 @@ handle_setup_req(#httpd{method='POST'}=Req) ->
     ok = chttpd:verify_is_server_admin(Req),
     couch_httpd:validate_ctype(Req, "application/json"),
     Setup = get_body(Req),
-    io:format("~nSetup: ~p~n", [Setup]),
+    couch_log:notice("Setup: ~p~n", [Setup]),
     Action = binary_to_list(couch_util:get_value(<<"action">>, Setup, <<"missing">>)),
     case handle_action(Action, Setup) of
     ok ->
@@ -68,17 +68,17 @@ handle_action("enable_cluster", Setup) ->
 
 
 handle_action("finish_cluster", Setup) ->
-    io:format("~nffinish_cluster: ~p~n", [Setup]),
+    couch_log:notice("finish_cluster: ~p~n", [Setup]),
     case setup:finish_cluster() of
         {error, cluster_finished} ->
             {error, <<"Cluster is already finished">>};
         Else ->
-            io:format("~nElse: ~p~n", [Else]),
+            couch_log:notice("Else: ~p~n", [Else]),
             ok
     end;
 
 handle_action("add_node", Setup) ->
-    io:format("~nadd_node: ~p~n", [Setup]),
+    couch_log:notice("add_node: ~p~n", [Setup]),
 
     Options = get_options([
         {username, <<"username">>},
@@ -99,10 +99,10 @@ handle_action("add_node", Setup) ->
     end;
 
 handle_action("remove_node", Setup) ->
-    io:format("~nremove_node: ~p~n", [Setup]);
+    couch_log:notice("remove_node: ~p~n", [Setup]);
 
 handle_action("receive_cookie", Setup) ->
-    io:format("~nreceive_cookie: ~p~n", [Setup]),
+    couch_log:notice("receive_cookie: ~p~n", [Setup]),
     Options = get_options([
        {cookie, <<"cookie">>}
     ], Setup),
@@ -113,7 +113,7 @@ handle_action("receive_cookie", Setup) ->
     end;
 
 handle_action(_, _) ->
-    io:format("~ninvalid_action: ~n", []),
+    couch_log:notice("invalid_action: ~n", []),
     {error, <<"Invalid Action'">>}.
 
 
@@ -122,6 +122,6 @@ get_body(Req) ->
     {Body} ->
         Body;
     Else ->
-        io:format("~nBody Fail: ~p~n", [Else]),
+        couch_log:notice("Body Fail: ~p~n", [Else]),
         couch_httpd:send_error(Req, 400, <<"bad_request">>, <<"Missing JSON body'">>)
     end.