iilyak closed pull request #1078: Refactor couch_log.erl
URL: https://github.com/apache/couchdb/pull/1078
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
diff --git a/src/couch_log/src/couch_log.erl b/src/couch_log/src/couch_log.erl
index a80d4a4771..a8dc5d48d7 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 ->
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services