Class: GraphqlRails::Controller::LogControllerAction
- Inherits:
-
Object
- Object
- GraphqlRails::Controller::LogControllerAction
- Includes:
- Service
- Defined in:
- lib/graphql_rails/controller/log_controller_action.rb
Overview
logs controller start and end times
Constant Summary collapse
- START_PROCESSING_KEY =
'start_processing.graphql_action_controller'
- PROCESS_ACTION_KEY =
'process_action.graphql_action_controller'
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(controller_name:, action_name:, params:, graphql_request:) ⇒ LogControllerAction
constructor
A new instance of LogControllerAction.
Constructor Details
#initialize(controller_name:, action_name:, params:, graphql_request:) ⇒ LogControllerAction
Returns a new instance of LogControllerAction.
17 18 19 20 21 22 |
# File 'lib/graphql_rails/controller/log_controller_action.rb', line 17 def initialize(controller_name:, action_name:, params:, graphql_request:) @controller_name = controller_name @action_name = action_name @params = params @graphql_request = graphql_request end |
Instance Method Details
#call ⇒ Object
24 25 26 27 28 29 30 31 |
# File 'lib/graphql_rails/controller/log_controller_action.rb', line 24 def call ActiveSupport::Notifications.instrument(START_PROCESSING_KEY, default_payload) ActiveSupport::Notifications.instrument(PROCESS_ACTION_KEY, default_payload) do |payload| yield.tap do payload[:status] = status end end end |