Websites/lib/middleware/silence_good_job_logging.rb

20 lines
418 B
Ruby

# frozen_string_literal: true
class SilenceGoodJobLogging
def initialize(app)
@app = app
end
def call(env)
request = Rack::Request.new(env)
host = request.env["websites.dev_host"].presence || request.host
if host == OtherRoutes::ADMIN_DOMAIN && env["PATH_INFO"].start_with?("/jobs")
Rails.logger.silence do
@app.call(env)
end
else
@app.call(env)
end
end
end