couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kxe...@apache.org
Subject [1/2] couchdb-couch-log-lager git commit: Get lager event handlers from gen_event
Date Thu, 17 Mar 2016 09:26:20 GMT
Repository: couchdb-couch-log-lager
Updated Branches:
  refs/heads/master b2a0471a8 -> a7a8b7efb


Get lager event handlers from gen_event

The existing mechanism for getting lager_event's handlers incorrectly
uses the data structure returned by application:get_env, which is a
configuration defined in sys.config. The actual lager_event handler
list is obtained directly from gen_event.

COUCHDB-2970


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

Branch: refs/heads/master
Commit: 3c4823facbeb52a8f539ea2cf04568c9e8cd4980
Parents: b2a0471
Author: Jay Doane <jay.s.doane@gmail.com>
Authored: Thu Mar 17 00:38:10 2016 -0700
Committer: Jay Doane <jay.s.doane@gmail.com>
Committed: Thu Mar 17 00:38:10 2016 -0700

----------------------------------------------------------------------
 src/couch_log_lager.erl | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-couch-log-lager/blob/3c4823fa/src/couch_log_lager.erl
----------------------------------------------------------------------
diff --git a/src/couch_log_lager.erl b/src/couch_log_lager.erl
index 504d359..56d4fcd 100644
--- a/src/couch_log_lager.erl
+++ b/src/couch_log_lager.erl
@@ -64,9 +64,9 @@ emergency(Fmt, Args) ->
 
 -spec set_level(atom()) -> ok.
 set_level(Level) ->
-    {ok, Handlers} = application:get_env(lager, handlers),
-    lists:foreach(fun({Handler, _}) ->
-        lager:set_loglevel(Handler, Level)
+    Handlers = gen_event:which_handlers(lager_event),
+    lists:foreach(fun(Handler) ->
+        ok = lager:set_loglevel(Handler, Level)
     end, Handlers).
 
 


Mime
View raw message