Sha256: fa3753acc7327e731927233d48585104d0e79ef46cc8d96ed1c0b162cf272406

Contents?: true

Size: 941 Bytes

Versions: 32

Compression:

Stored size: 941 Bytes

Contents

# frozen_string_literal: true

class LHC::Logging < LHC::Interceptor

  include ActiveSupport::Configurable
  config_accessor :logger

  def before_request
    return unless logger
    logger.info(
      [
        'Before LHC request',
        "<#{request.object_id}>",
        request.method.upcase,
        "#{request.url} at #{Time.now.iso8601}",
        "Params=#{request.params}",
        "Headers=#{request.headers}",
        request.source ? "\nCalled from #{request.source}" : nil
      ].compact.join(' ')
    )
  end

  def after_response
    return unless logger
    logger.info(
      [
        'After LHC response for request',
        "<#{request.object_id}>",
        request.method.upcase,
        "#{request.url} at #{Time.now.iso8601}",
        "Time=#{response.time_ms}ms",
        "URL=#{response.effective_url}",
        request.source ? "\nCalled from #{request.source}" : nil
      ].compact.join(' ')
    )
  end
end

Version data entries

32 entries across 32 versions & 1 rubygems

Version Path
lhc-13.2.0 lib/lhc/interceptors/logging.rb
lhc-13.1.0 lib/lhc/interceptors/logging.rb
lhc-13.0.0 lib/lhc/interceptors/logging.rb
lhc-12.3.0 lib/lhc/interceptors/logging.rb
lhc-12.2.1 lib/lhc/interceptors/logging.rb
lhc-12.2.0 lib/lhc/interceptors/logging.rb
lhc-12.1.3 lib/lhc/interceptors/logging.rb
lhc-12.1.2 lib/lhc/interceptors/logging.rb
lhc-12.1.1 lib/lhc/interceptors/logging.rb
lhc-12.1.0 lib/lhc/interceptors/logging.rb
lhc-12.0.3 lib/lhc/interceptors/logging.rb
lhc-12.0.2 lib/lhc/interceptors/logging.rb
lhc-12.0.1 lib/lhc/interceptors/logging.rb
lhc-12.0.0 lib/lhc/interceptors/logging.rb
lhc-11.2.0 lib/lhc/interceptors/logging.rb
lhc-11.1.1 lib/lhc/interceptors/logging.rb
lhc-11.1.0 lib/lhc/interceptors/logging.rb
lhc-11.0.2 lib/lhc/interceptors/logging.rb
lhc-11.0.1 lib/lhc/interceptors/logging.rb
lhc-11.0.0 lib/lhc/interceptors/logging.rb