You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@couchdb.apache.org by jaydoane <gi...@git.apache.org> on 2015/11/23 04:15:14 UTC

[GitHub] couchdb-couch-log pull request: Implement couch_log_devnull for su...

GitHub user jaydoane opened a pull request:

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

    Implement couch_log_devnull for suppressing logging during testing

    COUCHDB-2899

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

    $ git pull https://github.com/cloudant/couchdb-couch-log 2899-couch_log_devnull

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

    https://github.com/apache/couchdb-couch-log/pull/9.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 #9
    
----
commit 23725ffa4ec5360a3ea20478877c37187d1e7567
Author: Jay Doane <ja...@gmail.com>
Date:   2015-11-23T03:14:30Z

    Implement couch_log_devnull for suppressing logging during testing
    
    COUCHDB-2899

----


---
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 pull request: Implement couch_log_devnull for su...

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/pull/9#discussion_r45570910
  
    --- Diff: src/couch_log_devnull.erl ---
    @@ -0,0 +1,60 @@
    +% Licensed under the Apache License, Version 2.0 (the "License"); you may not
    +% use this file except in compliance with the License. You may obtain a copy of
    +% the License at
    +%
    +%   http://www.apache.org/licenses/LICENSE-2.0
    +%
    +% Unless required by applicable law or agreed to in writing, software
    +% distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
    +% WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
    +% License for the specific language governing permissions and limitations under
    +% the License.
    +
    +-module(couch_log_devnull).
    +
    +%% Useful for suppressing all logging output while running tests,
    +%% irrespective of backend
    +
    +-behaviour(couch_log).
    +
    +-export([
    +    debug/2,
    +    info/2,
    +    notice/2,
    +    warning/2,
    +    error/2,
    +    critical/2,
    +    alert/2,
    +    emergency/2,
    +    set_level/1
    +]).
    +
    +debug(Fmt, Args) ->
    +    write_log("[debug] " ++ Fmt, Args).
    +
    +info(Fmt, Args) ->
    +    write_log("[info] " ++ Fmt, Args).
    +
    +notice(Fmt, Args) ->
    +    write_log("[notice] " ++ Fmt, Args).
    +
    +warning(Fmt, Args) ->
    +    write_log("[warning] " ++ Fmt, Args).
    +
    +error(Fmt, Args) ->
    +    write_log("[error] " ++ Fmt, Args).
    +
    +critical(Fmt, Args) ->
    +    write_log("[critical] " ++ Fmt, Args).
    +
    +alert(Fmt, Args) ->
    +    write_log("[alert] " ++ Fmt, Args).
    +
    +emergency(Fmt, Args) ->
    +    write_log("[emergency] " ++ Fmt, Args).
    --- End diff --
    
    Good point. Obviously, I just copied this from couch_log_stderr to minimize code diffs, but I'll get rid of pointless operations if you intend to eventually merge it.


---
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 pull request: Implement couch_log_devnull for su...

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

    https://github.com/apache/couchdb-couch-log/pull/9#issuecomment-158853795
  
    @jaydoane yea, I should add travis.yml everywhere. Thanks for reminder (:


---
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 pull request: Implement couch_log_devnull for su...

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

    https://github.com/apache/couchdb-couch-log/pull/9#issuecomment-158852721
  
    @jaydoane ok, so I just submitted https://github.com/apache/couchdb-couch-log/pull/10
    To solve your problem there is nothing need to do since [eunit.ini](https://github.com/apache/couchdb/blob/master/rel/files/eunit.ini) already contains magic option that turns off any logging so these calls will not reach the backend whatever it used.


---
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 pull request: Implement couch_log_devnull for su...

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

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


---
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 pull request: Implement couch_log_devnull for su...

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

    https://github.com/apache/couchdb-couch-log/pull/9#issuecomment-158842515
  
    Indeed, that's the easiest way to handle this, but I think it's not right one. In CouchDB 1.x we had special log level `none` which disables all the logging. And this one is correct: you shouldn't jungle backends to toggle logging activity - it's all the matter of logging level, where there is the highest one that suppress everything. 
    
    However, this will require more work to do and allow to configure couch_log via config. That's not bad, since that's need to do in anyway. Would you like to handle this?


---
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 pull request: Implement couch_log_devnull for su...

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

    https://github.com/apache/couchdb-couch-log/pull/9#issuecomment-158846637
  
    I can certainly look into configuring couch_log via config, but right now my priority is re-enabling the test suite for downstream CI builds. This is just a quick-and-dirty hack that would make my life a little easier for the time being, but I can understand not wanting it in couchdb.


---
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 pull request: Implement couch_log_devnull for su...

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

    https://github.com/apache/couchdb-couch-log/pull/9#discussion_r45570641
  
    --- Diff: src/couch_log_devnull.erl ---
    @@ -0,0 +1,60 @@
    +% Licensed under the Apache License, Version 2.0 (the "License"); you may not
    +% use this file except in compliance with the License. You may obtain a copy of
    +% the License at
    +%
    +%   http://www.apache.org/licenses/LICENSE-2.0
    +%
    +% Unless required by applicable law or agreed to in writing, software
    +% distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
    +% WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
    +% License for the specific language governing permissions and limitations under
    +% the License.
    +
    +-module(couch_log_devnull).
    +
    +%% Useful for suppressing all logging output while running tests,
    +%% irrespective of backend
    +
    +-behaviour(couch_log).
    +
    +-export([
    +    debug/2,
    +    info/2,
    +    notice/2,
    +    warning/2,
    +    error/2,
    +    critical/2,
    +    alert/2,
    +    emergency/2,
    +    set_level/1
    +]).
    +
    +debug(Fmt, Args) ->
    +    write_log("[debug] " ++ Fmt, Args).
    +
    +info(Fmt, Args) ->
    +    write_log("[info] " ++ Fmt, Args).
    +
    +notice(Fmt, Args) ->
    +    write_log("[notice] " ++ Fmt, Args).
    +
    +warning(Fmt, Args) ->
    +    write_log("[warning] " ++ Fmt, Args).
    +
    +error(Fmt, Args) ->
    +    write_log("[error] " ++ Fmt, Args).
    +
    +critical(Fmt, Args) ->
    +    write_log("[critical] " ++ Fmt, Args).
    +
    +alert(Fmt, Args) ->
    +    write_log("[alert] " ++ Fmt, Args).
    +
    +emergency(Fmt, Args) ->
    +    write_log("[emergency] " ++ Fmt, Args).
    --- End diff --
    
    Why construct another list if the result doesn't matters?


---
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 pull request: Implement couch_log_devnull for su...

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

    https://github.com/apache/couchdb-couch-log/pull/9#issuecomment-158853319
  
    @kxepal, excellent. Thank you! Looks like you'll need to add .travis.yml in your commit, though.


---
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.
---