Module: Logsy::ControllerHooks
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/logsy/controller_hooks.rb
Overview
Mix into your ApplicationController (or specific controllers) to emit a single “wide event” log line at end of request with the method, path, status, duration_ms, controller, action, error, and every Logsy tag that was set during the request.
(Request-id capture lives in Logsy::RackMiddleware, inserted automatically by the Railtie — not here. A controller callback fires too late to tag the “Started GET” / “Processing by” lines.)
Usage:
class ApplicationController < ActionController::API
include Logsy::ControllerHooks
end
Override ‘logsy_request_summary_extras` in your controller to add custom fields to the wide event:
def logsy_request_summary_extras
{ ip: request.remote_ip, user_agent: request.user_agent }
end