Module: Sinatra::Log::Extension
- Defined in:
- lib/herbert/Log.rb
Class Method Summary collapse
Class Method Details
.registered(app) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/herbert/Log.rb', line 12 def self.registered(app) case app.log_requests when :db provider = Herbert::LoggingProviders::MongoProvider.new(app.db) when :stdout provider = Herbert::LoggingProviders::StdoutProvider.new else provider = app.log_requests end Herbert::AppLogger.provider = provider # Make the app automatically inject refernce to iteself into the response, # so Sinatra::Response::finish can manipulate it app.before { response.app = self; @timer_start = Time.new; } app.after { @timer_stop = Time.new} end |