Sha256: cf16d263106b9a6c7c657dc857cc18cb4834e218484dfa3eeaff0fca808cc1be

Contents?: true

Size: 613 Bytes

Versions: 3

Compression:

Stored size: 613 Bytes

Contents

module ThreeScaleToolbox
  class ProxyLogger < BasicObject
    def initialize(subject)
      @subject = subject
    end

    def method_missing(name, *args)
      start_time = ::Process.clock_gettime(::Process::CLOCK_MONOTONIC)
      result = @subject.public_send(name, *args)
    ensure
      end_time = ::Process.clock_gettime(::Process::CLOCK_MONOTONIC) - start_time
      ::Kernel.warn "-- call #{name} args |#{args.inspect[0..2000]}| response |#{result.inspect[0..2000]}| - (#{end_time}s)"
      result
    end

    def respond_to_missing?(method_name, include_private = false)
      super
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
3scale_toolbox-0.17.1 lib/3scale_toolbox/proxy_logger.rb
3scale_toolbox-0.17.0 lib/3scale_toolbox/proxy_logger.rb
3scale_toolbox-0.16.0 lib/3scale_toolbox/proxy_logger.rb