class GoogleCloudRun::LoggerMiddleware

Public Class Methods

new(app) click to toggle source
# File lib/google_cloud_run/logger.rb, line 287
def initialize(app)
  @app = app
end

Public Instance Methods

call(env) click to toggle source

A middleware which injects the request into the Rails.logger

# File lib/google_cloud_run/logger.rb, line 292
def call(env)
  request = ActionDispatch::Request.new(env)
  Rails.logger.inject_request(request)
  @app.call(env)
ensure
  ActiveSupport::LogSubscriber.flush_all!
end