diff options
author | Mike Wallace <mikewallace1979@googlemail.com> | 2014-08-27 23:18:39 +0100 |
---|---|---|
committer | Jay Doane <jaydoane@apache.org> | 2021-04-19 00:35:19 -0700 |
commit | 1f4ed90f7470a377f94e1bc503c17d1ae8db7614 (patch) | |
tree | 3836b83689bb4bfa3958902e7bde2a6a22ca713c | |
parent | 9231c1165b6f05515ed47cb142114bfd57b38cc8 (diff) | |
download | couchdb-1f4ed90f7470a377f94e1bc503c17d1ae8db7614.tar.gz |
Don't include node name in diagnostic messages
Unless it is explicitly required for a check, avoid returning
the node name in diagnostic messages. The node name is added by
the logging code so including it in the messages is not necessary.
-rw-r--r-- | src/weatherreport/src/weatherreport_check_custodian.erl | 18 | ||||
-rw-r--r-- | src/weatherreport/src/weatherreport_check_mem3_sync.erl | 13 |
2 files changed, 14 insertions, 17 deletions
diff --git a/src/weatherreport/src/weatherreport_check_custodian.erl b/src/weatherreport/src/weatherreport_check_custodian.erl index 6749c274e..1beb99f5e 100644 --- a/src/weatherreport/src/weatherreport_check_custodian.erl +++ b/src/weatherreport/src/weatherreport_check_custodian.erl @@ -55,22 +55,20 @@ n_to_level(0) -> n_to_level(_) -> info. -report_to_message({DbName, ShardRange, {Type, N}}, NodeName) -> - {n_to_level(N), {Type, N, DbName, ShardRange, NodeName}}. +report_to_message({DbName, ShardRange, {Type, N}}) -> + {n_to_level(N), {Type, N, DbName, ShardRange}}. -spec check(list()) -> [{atom(), term()}]. check(_Opts) -> - NodeName = node(), case custodian:report() of [] -> - [{info, {ok, NodeName}}]; + [{info, ok}]; Report -> - lists:map(fun(R) -> report_to_message(R, NodeName) end, Report) + lists:map(fun(R) -> report_to_message(R) end, Report) end. -spec format(term()) -> {io:format(), [term()]}. -format({ok, NodeName}) -> - {"All shards available and alive according to node ~w.", [NodeName]}; -format({Type, N, DbName, ShardRange, NodeName}) -> - {"~w ~w shards for Db: ~s Range: ~w according to node ~w.", - [N, Type, DbName, ShardRange, NodeName]}. +format(ok) -> + {"All shards available and alive.", []}; +format({Type, N, DbName, ShardRange}) -> + {"~w ~w shards for Db: ~s Range: ~w.", [N, Type, DbName, ShardRange]}. diff --git a/src/weatherreport/src/weatherreport_check_mem3_sync.erl b/src/weatherreport/src/weatherreport_check_mem3_sync.erl index 0fb0d70e5..8dfe41c02 100644 --- a/src/weatherreport/src/weatherreport_check_mem3_sync.erl +++ b/src/weatherreport/src/weatherreport_check_mem3_sync.erl @@ -41,16 +41,15 @@ valid() -> -spec check(list()) -> [{atom(), term()}]. check(_Opts) -> - NodeName = node(), case erlang:whereis(mem3_sync) of undefined -> - [{warning, {mem3_sync_not_found, NodeName}}]; + [{warning, mem3_sync_not_found}]; Pid -> - [{info, {mem3_sync_found, NodeName, Pid}}] + [{info, {mem3_sync_found, Pid}}] end. -spec format(term()) -> {io:format(), [term()]}. -format({mem3_sync_not_found, NodeName}) -> - {"No mem3_sync process found on local node ~w", [NodeName]}; -format({mem3_sync_found, NodeName, Pid}) -> - {"mem3_sync process found on local node ~w with pid ~w", [NodeName, Pid]}. +format(mem3_sync_not_found) -> + {"No mem3_sync process found on local node.", []}; +format({mem3_sync_found, Pid}) -> + {"mem3_sync process found on local node with pid ~w", [Pid]}. |