Redact response logs for certain cases (#757)

This commit is contained in:
Daniel Azuma authored and GitHub committed 2019-01-30 14:14:21 -08:00
1 parent 0c93c4565a
commit 9b43faa06e
2 files changed
+81 -1

No files matched your search

+9 -1
View File
@@ -305,7 +305,7 @@ module Google
header: request_header,
follow_redirect: true)
logger.debug { @http_res.status }
logger.debug { @http_res.inspect }
logger.debug { safe_response_representation @http_res }
response = process_response(@http_res.status.to_i, @http_res.header, @http_res.body)
success(response)
rescue => e
@@ -346,6 +346,14 @@ module Google
end
end
def safe_response_representation http_res
if respond_to?(:response_class) && response_class.is_a?(Class) &&
UNSAFE_CLASS_NAMES.include?(response_class.name)
return "#<#{http_res.class.name} (fields redacted)>"
end
http_res.inspect
end
def opencensus_begin_span
return unless OPENCENSUS_AVAILABLE && options.use_opencensus
return if @opencensus_span