You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by rn...@apache.org on 2015/09/17 14:47:04 UTC

couch-log commit: updated refs/heads/master to ccbb81c

Repository: couchdb-couch-log
Updated Branches:
  refs/heads/master 275043eaa -> ccbb81c3d


Add ability to change log level at runtime


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

Branch: refs/heads/master
Commit: ccbb81c3d074671d15e07275bf3d1742dd6e2c1f
Parents: 275043e
Author: Robert Newson <rn...@apache.org>
Authored: Thu Sep 17 13:06:39 2015 +0100
Committer: Robert Newson <rn...@apache.org>
Committed: Thu Sep 17 13:06:39 2015 +0100

----------------------------------------------------------------------
 src/couch_log.erl | 5 +++++
 1 file changed, 5 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-couch-log/blob/ccbb81c3/src/couch_log.erl
----------------------------------------------------------------------
diff --git a/src/couch_log.erl b/src/couch_log.erl
index 256a4ef..8f85077 100644
--- a/src/couch_log.erl
+++ b/src/couch_log.erl
@@ -13,6 +13,7 @@
 -module(couch_log).
 
 -export([debug/2, info/2, notice/2, warning/2, error/2, critical/2, alert/2, emergency/2]).
+-export([set_level/1]).
 
 debug(Fmt, Args) ->
     catch couch_stats:increment_counter([couch_log, level, debug]),
@@ -45,3 +46,7 @@ alert(Fmt, Args) ->
 emergency(Fmt, Args) ->
     catch couch_stats:increment_counter([couch_log, level, emergency]),
     lager:emergency(Fmt, Args).
+
+set_level(Level) ->
+    {ok, Handlers} = application:get_env(lager, handlers),
+    [lager:set_loglevel(Handler, Level) || {Handler, _} <- Handlers].