You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@couchdb.apache.org by jaydoane <gi...@git.apache.org> on 2016/03/17 01:40:31 UTC

[GitHub] couchdb-couch-log-lager pull request: Get lager event handlers fro...

GitHub user jaydoane opened a pull request:

    https://github.com/apache/couchdb-couch-log-lager/pull/2

    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 returns a configuration data structure defined in sys.config. The actual lager_event handler list is obtained directly from gen_event.
    
    COUCHDB-2970

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/cloudant/couchdb-couch-log-lager 2970-lager-handlers-from-gen_event

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/couchdb-couch-log-lager/pull/2.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #2
    
----
commit 60d29078f27732cdc4e12a6ad81286b9062f8b61
Author: Jay Doane <ja...@gmail.com>
Date:   2016-03-17T00:37:54Z

    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 returns a configuration data structure defined in sys.config. The actual lager_event handler list is obtained directly from gen_event.
    
    COUCHDB-2970

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] couchdb-couch-log-lager pull request: Get lager event handlers fro...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/couchdb-couch-log-lager/pull/2


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] couchdb-couch-log-lager pull request: Get lager event handlers fro...

Posted by kxepal <gi...@git.apache.org>.
Github user kxepal commented on the pull request:

    https://github.com/apache/couchdb-couch-log-lager/pull/2#issuecomment-197785419
  
    Thank you!


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] couchdb-couch-log-lager pull request: Get lager event handlers fro...

Posted by jaydoane <gi...@git.apache.org>.
Github user jaydoane commented on the pull request:

    https://github.com/apache/couchdb-couch-log-lager/pull/2#issuecomment-197741520
  
    Commit message now wrapped


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] couchdb-couch-log-lager pull request: Get lager event handlers fro...

Posted by kxepal <gi...@git.apache.org>.
Github user kxepal commented on the pull request:

    https://github.com/apache/couchdb-couch-log-lager/pull/2#issuecomment-197727400
  
    One moment: commit message should be wrapped by 79/80 characters per line. 
    
    And then +1 (: Thanks!


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] couchdb-couch-log-lager pull request: Get lager event handlers fro...

Posted by eiri <gi...@git.apache.org>.
Github user eiri commented on a diff in the pull request:

    https://github.com/apache/couchdb-couch-log-lager/pull/2#discussion_r56441052
  
    --- Diff: src/couch_log_lager.erl ---
    @@ -64,10 +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)
    -    end, Handlers).
    +    Handlers = gen_event:which_handlers(lager_event),
    +    [ok = lager:set_loglevel(Handler, Level) || Handler <- Handlers],
    --- End diff --
    
    I'd suggest to keep foreach here, it's more idiomatically correct and you wouldn't need an explicit `ok` at the end. 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] couchdb-couch-log-lager pull request: Get lager event handlers fro...

Posted by eiri <gi...@git.apache.org>.
Github user eiri commented on the pull request:

    https://github.com/apache/couchdb-couch-log-lager/pull/2#issuecomment-197638745
  
    lgtm


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] couchdb-couch-log-lager pull request: Get lager event handlers fro...

Posted by jaydoane <gi...@git.apache.org>.
Github user jaydoane commented on a diff in the pull request:

    https://github.com/apache/couchdb-couch-log-lager/pull/2#discussion_r56443141
  
    --- Diff: src/couch_log_lager.erl ---
    @@ -64,10 +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)
    -    end, Handlers).
    +    Handlers = gen_event:which_handlers(lager_event),
    +    [ok = lager:set_loglevel(Handler, Level) || Handler <- Handlers],
    --- End diff --
    
    Updated to keep foreach


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---