Sha256: bb44ded4eec14552bf936644878e921812326f2e8583bca3dece9895670bd0bd

Contents?: true

Size: 507 Bytes

Versions: 5

Compression:

Stored size: 507 Bytes

Contents

module QueryDiet
  module Rack
    class ResetLogger

      def initialize(app)
        @app = app
      end

      def call(env)
        QueryDiet::Logger.reset
        @app.call(env)
      end

    end
  end
end

if defined?(Rails::Railtie)
  class QueryDiet::Railtie < Rails::Railtie
    initializer 'query_diet.insert_middleware' do |app|
      app.config.middleware.use 'QueryDiet::Rack::ResetLogger'
    end
  end
else
  ActionController::Dispatcher.middleware.use('QueryDiet::Rack::ResetLogger')
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
query_diet-0.5.3 lib/query_diet/rack/reset_logger.rb
query_diet-0.5.2 lib/query_diet/rack/reset_logger.rb
query_diet-0.5.1 lib/query_diet/rack/reset_logger.rb
query_diet-0.5.0 lib/query_diet/rack/reset_logger.rb
query_diet-0.4.0 lib/query_diet/rack/reset_logger.rb