module Sinatra::Verbose
Sinatra::Verbose
¶ ↑
Extension to log verbosely. Useful during development, since it will automatically log all the blocks that are invoked.
Usage¶ ↑
Classic Application¶ ↑
To enable the verbose logger in a classic application all you need to do is require it:
require "sinatra" require "sinatra/verbose" if development? # Your classic application code goes here...
Modular Application¶ ↑
To enable the verbose logger in a modular application all you need to do is require it, and then, register it:
require "sinatra/base" require "sinatra/verbose" class MyApp < Sinatra::Base configure :development do register Sinatra::Verbose end # Your modular application code goes here... end
Constants
- VERSION
Public Instance Methods
after(path = nil, options = {}, &block)
click to toggle source
Calls superclass method
# File lib/sinatra/verbose.rb, line 46 def after(path = nil, options = {}, &block) blk, block = block, Proc.new do logger.info "passing through an after block at #{blk.source_location.join(':')}" blk.call end super path, options, &block end
before(path = nil, options = {}, &block)
click to toggle source
Calls superclass method
# File lib/sinatra/verbose.rb, line 38 def before(path = nil, options = {}, &block) blk, block = block, Proc.new do logger.info "passing through a before block at #{blk.source_location.join(':')}" blk.call end super path, options, &block end
error(*codes, &block)
click to toggle source
Calls superclass method
# File lib/sinatra/verbose.rb, line 54 def error(*codes, &block) blk, block = block, Proc.new do logger.info "passing through an error block at #{blk.source_location.join(':')}" blk.call end super codes, &block end