Class: Excon::StandardInstrumentor

Inherits:
Object
  • Object
show all
Defined in:
lib/excon/standard_instrumentor.rb

Class Method Summary collapse

Class Method Details

.instrument(name, params = {}, &block) ⇒ Object


3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/excon/standard_instrumentor.rb', line 3

def self.instrument(name, params = {}, &block)
  params = params.dup

  # reduce duplication/noise of output
  params.delete(:connection)
  params.delete(:stack)

  if params.has_key?(:headers) && params[:headers].has_key?('Authorization')
    params[:headers] = params[:headers].dup
    params[:headers]['Authorization'] = REDACTED
  end

  if params.has_key?(:password)
    params[:password] = REDACTED
  end

  $stderr.puts(name)
  Excon::PrettyPrinter.pp($stderr, params)

  if block_given?
    yield
  end
end