Skip to content

Commit

Permalink
feat: Improved logging some more
Browse files Browse the repository at this point in the history
Now triggers the `log_request_result` method to include the same info at the start of the request as in PPD explorer. Also reverted the renaming of the method to keep things simple.
  • Loading branch information
jonrandahl committed Jun 29, 2023
1 parent 474b28a commit 91ea4ba
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,18 @@ class ApplicationController < ActionController::Base

before_action :set_locale, :change_default_caching_policy

around_action :log_request_result
def log_request_result
start = Process.clock_gettime(Process::CLOCK_MONOTONIC, :microsecond)
yield
duration = Process.clock_gettime(Process::CLOCK_MONOTONIC, :microsecond) - start
detailed_request_log(duration)
end

private

# rubocop:disable Metrics/MethodLength, Metrics/AbcSize
def create_detailed_request_log(duration)
def detailed_request_log(duration)
env = request.env

log_fields = {
Expand Down

0 comments on commit 91ea4ba

Please sign in to comment.