Module: Finicity::Logger

Instance Method Summary collapse

Instance Method Details

#log_requestObject



3
4
5
6
7
8
9
10
11
# File 'lib/finicity/logger.rb', line 3

def log_request
  ::Finicity.logger.debug do
    log = "REQUEST: #{self.class.name}"
    log << "\n  URL: #{url}" if self.respond_to?(:url)
    log << "\n  QUERY: #{query}" if self.respond_to?(:query)
    log << "\n  BODY: #{mask_body(body)}" if self.respond_to?(:body)
    log
  end
end

#mask_body(body) ⇒ Object



13
14
15
16
17
# File 'lib/finicity/logger.rb', line 13

def mask_body(body)
  body = body.gsub(/<value>.*<\/value>/, "<value>[FILTERED]</value>")
  body = body.gsub(/<answer>.*<\/answer>/, "<answer>[FILTERED]</answer>")
  body
end