summaryrefslogtreecommitdiff
path: root/lib/vendor/excon/lib/excon/standard_instrumentor.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/vendor/excon/lib/excon/standard_instrumentor.rb')
-rw-r--r--lib/vendor/excon/lib/excon/standard_instrumentor.rb28
1 files changed, 28 insertions, 0 deletions
diff --git a/lib/vendor/excon/lib/excon/standard_instrumentor.rb b/lib/vendor/excon/lib/excon/standard_instrumentor.rb
new file mode 100644
index 0000000..575a42c
--- /dev/null
+++ b/lib/vendor/excon/lib/excon/standard_instrumentor.rb
@@ -0,0 +1,28 @@
+# frozen_string_literal: true
+module Excon
+ class StandardInstrumentor
+ 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
+ end
+end