Class: ThreeScaleToolbox::ProxyLogger
- Inherits:
- BasicObject
- Defined in:
- lib/3scale_toolbox/proxy_logger.rb
Instance Method Summary collapse
-
#initialize(subject) ⇒ ProxyLogger
constructor
A new instance of ProxyLogger.
- #method_missing(name, *args) ⇒ Object
- #respond_to_missing?(method_name, include_private = false) ⇒ Boolean
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 |
# 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
#respond_to_missing?(method_name, include_private = false) ⇒ Boolean
16 17 18 |
# File 'lib/3scale_toolbox/proxy_logger.rb', line 16 def respond_to_missing?(method_name, include_private = false) super end |