設定日誌標記、記錄請求、呼叫應用程式,並清除日誌。
日誌標記 (標記
) 可以是一個 陣列
,包含:請求
物件回應的方法、回應 to_s
的物件,或是接受 請求
物件實例的 Proc 物件。
方法
類別公開方法
new(app, taggers = nil) 連結
執行個體公開方法
call(env) 連結
執行個體私人方法
call_app(request, env) 連結
# File railties/lib/rails/rack/logger.rb, line 33 def call_app(request, env) # :doc: logger_tag_pop_count = env["rails.rack_logger_tag_count"] instrumenter = ActiveSupport::Notifications.instrumenter handle = instrumenter.build_handle("request.action_dispatch", { request: request }) handle.start logger.info { started_request_message(request) } status, headers, body = response = @app.call(env) body = ::Rack::BodyProxy.new(body) { finish_request_instrumentation(handle, logger_tag_pop_count) } if response.frozen? [status, headers, body] else response[2] = body response end rescue Exception finish_request_instrumentation(handle, logger_tag_pop_count) raise end
started_request_message(request) 連結
開始針對 127.0.0.1 在 2012-09-26 14:51:42 -0700 進行 GET “/session/new”