Logging in Sinatra?

Sinatra 1.3 will ship with such a logger object, exactly usable as above. You can use edge Sinatra as described in “The Bleeding Edge“. Won’t be that long until we’ll release 1.3, I guess.

To use it with Sinatra 1.2, do something like this:

require 'sinatra'
use Rack::Logger

helpers do
  def logger
    request.logger
  end
end

Leave a Comment