Module: Muffler

Defined in:
lib/muffler.rb,
lib/muffler/rails.rb,
lib/muffler/config.rb,
lib/muffler/version.rb,
lib/muffler/rack/logger.rb,
lib/muffler/rails/logger.rb,
lib/muffler/rack/commonlogger.rb

Defined Under Namespace

Modules: Rack, Rails Classes: Config

Constant Summary collapse

VERSION =
"0.0.1"

Class Method Summary collapse

Class Method Details

.configObject



30
31
32
# File 'lib/muffler.rb', line 30

def config
  @config ||= Config.new
end

.configure {|config| ... } ⇒ Object

Yields:



26
27
28
# File 'lib/muffler.rb', line 26

def configure
  yield config
end

.muffle(logger, level = Logger::ERROR) ⇒ Object



17
18
19
20
21
22
23
24
# File 'lib/muffler.rb', line 17

def muffle(logger, level=Logger::ERROR)
  original_level = logger.level
  logger.level = level

  yield
ensure
  logger.level = original_level
end

.muffle?(opts = {}) ⇒ Boolean

Returns:

  • (Boolean)


13
14
15
# File 'lib/muffler.rb', line 13

def muffle?(opts={})
  config.mufflers.values.any? { |m| m.call(opts) }
end