Class: Savon::RequestLogger

Inherits:
Object
  • Object
show all
Defined in:
lib/savon/request_logger.rb

Instance Method Summary collapse

Constructor Details

#initialize(globals) ⇒ RequestLogger

Returns a new instance of RequestLogger.



6
7
8
# File 'lib/savon/request_logger.rb', line 6

def initialize(globals)
  @globals = globals
end

Instance Method Details

#log(request, &http_request) ⇒ Object



10
11
12
13
14
15
16
# File 'lib/savon/request_logger.rb', line 10

def log(request, &http_request)
  log_request(request) if log?
  response = http_request.call
  log_response(response) if log?

  response
end

#log?Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/savon/request_logger.rb', line 22

def log?
  @globals[:log]
end

#loggerObject



18
19
20
# File 'lib/savon/request_logger.rb', line 18

def logger
  @globals[:logger]
end