class VCR::Logger

@private Provides log message formatting helper methods.

Public Class Methods

new(stream) click to toggle source
# File lib/vcr/util/logger.rb, line 5
def initialize(stream)
  @stream = stream
end

Public Instance Methods

log(message, log_prefix, indentation_level = 0) click to toggle source
# File lib/vcr/util/logger.rb, line 9
def log(message, log_prefix, indentation_level = 0)
  indentation = '  ' * indentation_level
  log_message = indentation + log_prefix + message
  @stream.puts log_message
end
request_summary(request, request_matchers) click to toggle source
# File lib/vcr/util/logger.rb, line 15
def request_summary(request, request_matchers)
  attributes = [request.method, request.uri]
  attributes << request.body.to_s[0, 80].inspect if request_matchers.include?(:body)
  attributes << request.headers.inspect          if request_matchers.include?(:headers)
  "[#{attributes.join(" ")}]"
end
response_summary(response) click to toggle source
# File lib/vcr/util/logger.rb, line 22
def response_summary(response)
  "[#{response.status.code} #{response.body[0, 80].inspect}]"
end