Sha256: cc8774b4e33b8155c562e91a5a3d86c668d90d83a2fd4b4f5d507afc04cc1aa6

Contents?: true

Size: 909 Bytes

Versions: 9

Compression:

Stored size: 909 Bytes

Contents

# Copyright (c) 2021 Contrast Security, Inc. See https://www.contrastsecurity.com/enduser-terms-0317a for more details.
# frozen_string_literal: true

require 'contrast/utils/timer'

module Contrast
  module Logger
    # Our decorator for the Ougai logger allowing for the logging of the
    # request lifecycle, used to provide context during troubleshooting.
    module Request
      # Utility method to log the start of a request
      def request_start
        debug('Beginning request analysis')
      end

      # Utility method to log the end of a request, including the time it took
      # for that request to be processed.
      def request_end
        context = Contrast::Agent::REQUEST_TRACKER.current
        elapsed_time = context ? (Contrast::Utils::Timer.now_ms - context.timer.start_ms) : -1
        debug('Ending request analysis', elapsed_time_ms: elapsed_time)
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
contrast-agent-4.14.1 lib/contrast/logger/request.rb
contrast-agent-4.14.0 lib/contrast/logger/request.rb
contrast-agent-4.13.1 lib/contrast/logger/request.rb
contrast-agent-4.13.0 lib/contrast/logger/request.rb
contrast-agent-4.12.0 lib/contrast/logger/request.rb
contrast-agent-4.11.0 lib/contrast/logger/request.rb
contrast-agent-4.10.0 lib/contrast/logger/request.rb
contrast-agent-4.9.1 lib/contrast/logger/request.rb
contrast-agent-4.9.0 lib/contrast/logger/request.rb