# File lib/couchrest/middlewares/logger.rb, line 20 def self.log Thread.current["couchrest.logger"] ||= {:queries => []} end
# File lib/couchrest/middlewares/logger.rb, line 41 def call(env) reset_log log['started_at'] = Time.now log['env'] = env log['url'] = 'http://' + env['HTTP_HOST'] + env['REQUEST_URI'] response = @app.call(env) log['ended_at'] = Time.now log['duration'] = log['ended_at'] - log['started_at'] # let's report the log in a different thread so we don't slow down the app @db ? Thread.new(@db, log){|db, rlog| db.save_doc(rlog);} : p(log.inspect) response end
Generated with the Darkfish Rdoc Generator 2.