Class: Nightwing::ClientLogger

Inherits:
Object
  • Object
show all
Defined in:
lib/nightwing/client_logger.rb

Instance Method Summary collapse

Constructor Details

#initialize(client:, logger:) ⇒ ClientLogger

Returns a new instance of ClientLogger.



3
4
5
6
# File 'lib/nightwing/client_logger.rb', line 3

def initialize(client:, logger:)
  @client = client
  @logger = logger
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args, &block) ⇒ Object



8
9
10
11
12
13
14
15
# File 'lib/nightwing/client_logger.rb', line 8

def method_missing(method, *args, &block)
  unless @client.respond_to?(method)
    super
  end

  @logger.info "method=#{method} metric=#{args[0]} value=#{args.last if args.size > 1}"
  @client.public_send(method, *args)
end