lib/ezlog/railtie.rb in ezlog-0.6.0 vs lib/ezlog/railtie.rb in ezlog-0.7.0

- old
+ new

@@ -1,9 +1,11 @@ module Ezlog class Railtie < Rails::Railtie config.ezlog = ActiveSupport::OrderedOptions.new config.ezlog.enable_sequel_logging = false + config.ezlog.log_only_whitelisted_params = false + config.ezlog.whitelisted_params = [:controller, :action] initializer "ezlog.initialize" do require "ezlog/rails/extensions" end @@ -25,11 +27,11 @@ end initializer 'ezlog.configure_rails_middlewares' do |app| app.config.middleware.insert_after ::ActionDispatch::RequestId, Ezlog::Rails::RequestLogContext app.config.middleware.delete ::Rails::Rack::Logger - app.config.middleware.insert_before ::ActionDispatch::DebugExceptions, Ezlog::Rails::AccessLog, Ezlog.logger('AccessLog') + app.config.middleware.insert_before ::ActionDispatch::DebugExceptions, Ezlog::Rails::AccessLog, Ezlog.logger('AccessLog'), whitelisted_params(app) app.config.middleware.insert_after ::ActionDispatch::DebugExceptions, Ezlog::Rails::LogExceptions, Ezlog.logger('Application') end config.after_initialize do Ezlog::Rails::LogSubscriber.detach ::ActionController::LogSubscriber @@ -57,8 +59,12 @@ end end def disable_rack_timeout_logging ::Rack::Timeout::Logger.logger = ::Logger.new(nil) + end + + def whitelisted_params(app) + app.config.ezlog.log_only_whitelisted_params ? app.config.ezlog.whitelisted_params : nil end end end