Class: ThreeScaleToolbox::ProxyLogger
- Inherits:
-
BasicObject
- Defined in:
- lib/3scale_toolbox/proxy_logger.rb
Instance Method Summary
collapse
Constructor Details
#initialize(subject) ⇒ ProxyLogger
Returns a new instance of ProxyLogger.
3
4
5
|
# File 'lib/3scale_toolbox/proxy_logger.rb', line 3
def initialize(subject)
@subject = subject
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args) ⇒ Object
7
8
9
10
11
12
13
14
15
|
# File 'lib/3scale_toolbox/proxy_logger.rb', line 7
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
|
Instance Method Details
#public_send(name, *args) ⇒ Object
18
19
20
|
# File 'lib/3scale_toolbox/proxy_logger.rb', line 18
def public_send(name, *args)
method_missing(name, *args)
end
|
#respond_to_missing?(method_name, include_private = false) ⇒ Boolean
22
23
24
|
# File 'lib/3scale_toolbox/proxy_logger.rb', line 22
def respond_to_missing?(method_name, include_private = false)
super
end
|