summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoriilyak <iilyak@ca.ibm.com>2017-12-20 16:17:18 -0800
committerGitHub <noreply@github.com>2017-12-20 16:17:18 -0800
commit3c90cc3aa72090ad6db8675167a1af17ed5182f4 (patch)
treed537279af89acd6fc1a590003754c1040e712e01
parent3b28b84da610114626fb6c1f83e44ae874e33d8b (diff)
parentdd7cb4e835f03392f95f0b02e94dbfa38fdf94c6 (diff)
downloadcouchdb-3c90cc3aa72090ad6db8675167a1af17ed5182f4.tar.gz
Merge pull request #1078 from cloudant/issue-832-couch_log-refactor
Refactor couch_log.erl
-rw-r--r--src/couch_log/src/couch_log.erl33
1 files changed, 9 insertions, 24 deletions
diff --git a/src/couch_log/src/couch_log.erl b/src/couch_log/src/couch_log.erl
index a80d4a477..a8dc5d48d 100644
--- a/src/couch_log/src/couch_log.erl
+++ b/src/couch_log/src/couch_log.erl
@@ -28,51 +28,35 @@
-spec debug(string(), list()) -> ok.
-debug(Fmt, Args) ->
- couch_stats:increment_counter([couch_log, level, debug]),
- log(debug, Fmt, Args).
+debug(Fmt, Args) -> log(debug, Fmt, Args).
-spec info(string(), list()) -> ok.
-info(Fmt, Args) ->
- couch_stats:increment_counter([couch_log, level, info]),
- log(info, Fmt, Args).
+info(Fmt, Args) -> log(info, Fmt, Args).
-spec notice(string(), list()) -> ok.
-notice(Fmt, Args) ->
- couch_stats:increment_counter([couch_log, level, notice]),
- log(notice, Fmt, Args).
+notice(Fmt, Args) -> log(notice, Fmt, Args).
-spec warning(string(), list()) -> ok.
-warning(Fmt, Args) ->
- couch_stats:increment_counter([couch_log, level, warning]),
- log(warning, Fmt, Args).
+warning(Fmt, Args) -> log(warning, Fmt, Args).
-spec error(string(), list()) -> ok.
-error(Fmt, Args) ->
- couch_stats:increment_counter([couch_log, level, error]),
- log(error, Fmt, Args).
+error(Fmt, Args) -> log(error, Fmt, Args).
-spec critical(string(), list()) -> ok.
-critical(Fmt, Args) ->
- couch_stats:increment_counter([couch_log, level, critical]),
- log(critical, Fmt, Args).
+critical(Fmt, Args) -> log(critical, Fmt, Args).
-spec alert(string(), list()) -> ok.
-alert(Fmt, Args) ->
- couch_stats:increment_counter([couch_log, level, alert]),
- log(alert, Fmt, Args).
+alert(Fmt, Args) -> log(alert, Fmt, Args).
-spec emergency(string(), list()) -> ok.
-emergency(Fmt, Args) ->
- couch_stats:increment_counter([couch_log, level, emergency]),
- log(emergency, Fmt, Args).
+emergency(Fmt, Args) -> log(emergency, Fmt, Args).
-spec set_level(atom() | string() | integer()) -> true.
@@ -84,6 +68,7 @@ set_level(Level) ->
log(Level, Fmt, Args) ->
case couch_log_util:should_log(Level) of
true ->
+ couch_stats:increment_counter([couch_log, level, Level]),
Entry = couch_log_formatter:format(Level, self(), Fmt, Args),
ok = couch_log_server:log(Entry);
false ->