Easily suppress the Rails logger
Pull request Compare This branch is 89 commits behind stve:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib
spec
tmp
.gemtest
.gitignore
.rspec
.simplecov
.yardopts
Gemfile
Guardfile
LICENSE.md
README.md
Rakefile
silencer.gemspec

README.md

Silencer

Silencer is a simple rack-middleware for Rails that can selectively disable logging on per-action basis. It's based on a blog post by Dennis Reimann.

Installation

Just add silencer to your Gemfile:

gem 'silencer'

Usage

In your production environment (presumably):

require 'silencer/logger'

config.middleware.swap Rails::Rack::Logger, Silencer::Logger, :silence => ["/noisy/action.json"]

Silencer's logger will serve as a drop-in replacement for Rails default logger. It will not suppress any logging by default, simply pass it an array of urls via the options hash. You can also send it a 'X-SILENCE-LOGGER' header (with any value) with your request and that will also produce the same behavior.

Note on Patches/Pull Requests

  • Fork the project.
  • Make your feature addition or bug fix.
  • Add tests for it. This is important so I don't break it in a future version unintentionally.
  • Commit, do not mess with rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
  • Send me a pull request. Bonus points for topic branches.

Copyright

Copyright (c) 2011 Steve Agalloco. See LICENSE for details.