Change logged representation of certain classes (#752)
This commit is contained in:
1 parent
4ccc4ed71b
commit
55320753c7
2 files changed
+42
-1
No files matched your search
@@ -253,7 +253,7 @@ module Google
|
||||
# @return [Object] result if no block given
|
||||
# @yield [result, nil] if block given
|
||||
def success(result, &block)
|
||||
logger.debug { sprintf('Success - %s', PP.pp(result, '')) }
|
||||
logger.debug { sprintf('Success - %s', safe_object_representation(result)) }
|
||||
block.call(result, nil) if block_given?
|
||||
result
|
||||
end
|
||||
@@ -333,6 +333,19 @@ module Google
|
||||
|
||||
private
|
||||
|
||||
UNSAFE_CLASS_NAMES = [
|
||||
"Google::Apis::CloudkmsV1::DecryptResponse"
|
||||
]
|
||||
|
||||
def safe_object_representation obj
|
||||
name = obj.class.name
|
||||
if UNSAFE_CLASS_NAMES.include? name
|
||||
"#<#{name} (fields redacted)>"
|
||||
else
|
||||
PP.pp(obj, "")
|
||||
end
|
||||
end
|
||||
|
||||
def opencensus_begin_span
|
||||
return unless OPENCENSUS_AVAILABLE && options.use_opencensus
|
||||
return if @opencensus_span
|
||||
|
||||
Reference in new issue
Block a user