Class: Protor::LoggerClient

Inherits:
Object
  • Object
show all
Defined in:
lib/protor/logger_client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(logger, formatter) ⇒ LoggerClient

Returns a new instance of LoggerClient.



5
6
7
8
# File 'lib/protor/logger_client.rb', line 5

def initialize(logger, formatter)
  @logger = logger
  @formatter = formatter
end

Instance Attribute Details

#formatterObject (readonly)

Returns the value of attribute formatter.



3
4
5
# File 'lib/protor/logger_client.rb', line 3

def formatter
  @formatter
end

#loggerObject (readonly)

Returns the value of attribute logger.



3
4
5
# File 'lib/protor/logger_client.rb', line 3

def logger
  @logger
end

Instance Method Details

#publish(payload) ⇒ Object



10
11
12
13
14
# File 'lib/protor/logger_client.rb', line 10

def publish(payload)
  formatter.format(payload) do |msg|
    logger.info(msg)
  end
end