class Grape::Middleware::Logger::Railtie < Rails::Railtie
  options = Rails::VERSION::MAJOR < 5 ? { after: :load_config_initializers } : {}
  initializer 'grape.middleware.logger', options do
    Grape::Middleware::Logger.logger = Rails.application.config.logger || Rails.logger.presence
    Grape::Middleware::Logger.filter = ActionDispatch::Http::ParameterFilter.new Rails.application.config.filter_parameters
  end
end

class Grape::Middleware::Logger::Railtie < Rails::Railtie
  options = Rails::VERSION::MAJOR < 5 ? { after: :load_config_initializers } : {}
  initializer 'grape.middleware.logger', options do
    Grape::Middleware::Logger.logger = Rails.application.config.logger || Rails.logger.presence
    parameter_filter_class = if Rails::VERSION::MAJOR >= 6
                               ActiveSupport::ParameterFilter
                             else
                               ActionDispatch::Http::ParameterFilter
                             end
    Grape::Middleware::Logger.filter = parameter_filter_class.new Rails.application.config.filter_parameters
  end
end

Use ActiveSupport::ParameterFilter instead of ActionDispatch::Http::ParameterFilter in Rails 6 and above
Use ActiveSupport::ParameterFilter instead of ActionDispatch::Http::ParameterFilter in Rails 6 and above
