couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kxe...@apache.org
Subject couchdb-couch-log-lager git commit: Reset error_logger_tty handler only if it was already specified
Date Thu, 08 Oct 2015 09:46:29 GMT
Repository: couchdb-couch-log-lager
Updated Branches:
  refs/heads/master 64cd100cb -> b2a0471a8


Reset error_logger_tty handler only if it was already specified


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/b2a0471a
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-couch-log-lager/tree/b2a0471a
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-couch-log-lager/diff/b2a0471a

Branch: refs/heads/master
Commit: b2a0471a87765de50c5eb05c65c121f68a9ae9fa
Parents: 64cd100
Author: Alexander Shorin <kxepal@apache.org>
Authored: Thu Oct 8 12:24:47 2015 +0300
Committer: Alexander Shorin <kxepal@apache.org>
Committed: Thu Oct 8 12:24:47 2015 +0300

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


http://git-wip-us.apache.org/repos/asf/couchdb-couch-log-lager/blob/b2a0471a/src/couch_log_lager.erl
----------------------------------------------------------------------
diff --git a/src/couch_log_lager.erl b/src/couch_log_lager.erl
index b9364ea..504d359 100644
--- a/src/couch_log_lager.erl
+++ b/src/couch_log_lager.erl
@@ -89,16 +89,19 @@ setup() ->
     setup_lager().
 
 setup_lager() ->
+    Handlers = gen_event:which_handlers(error_logger),
+    HasTTY = lists:member(error_logger_tty_h, Handlers),
     error_logger:tty(false),
     application:load(lager),
     application:set_env(lager, handlers, [{lager_console_backend, info}]),
     application:set_env(lager, error_logger_redirect, false),
     application:set_env(lager, async_threshold, undefined),
-    lager:start().
+    lager:start(),
+    HasTTY.
 
-cleanup(_) ->
+cleanup(HasTTY) ->
     application:stop(lager),
     application:stop(goldrush),
-    error_logger:tty(true).
+    error_logger:tty(HasTTY).
 
 -endif.


Mime
View raw message