lib/finapps/utils/logging.rb in finapps-0.21.4.pre vs lib/finapps/utils/logging.rb in finapps-0.21.5.pre

- old
+ new

@@ -53,25 +53,31 @@ # @param [Hash] hash def skip_sensitive_data(hash) if hash.is_a? Hash filtered_hash = hash.clone - filtered_hash.update(filtered_hash) { |key, v1| filter_sensitive_values(key, v1) } + filtered_hash.each do |key, value| + if PROTECTED_KEYS.include? key.to_s.downcase + filtered_hash[key] = '[REDACTED]' + elsif value.is_a?(Hash) + filtered_hash[key] = self.skip_sensitive_data(value) + elsif value.is_a?(Array) + filtered_hash[key] = value.map { |v| v.is_a?(Hash) ? self.skip_sensitive_data(v) : v } + end + end + + filtered_hash else hash end end private def format_datetime(time) time.strftime('%Y-%m-%dT%H:%M:%S.') << '%06d ' % time.usec end - def filter_sensitive_values(key, v1) - (PROTECTED_KEYS.include? key.to_s.downcase) ? '[REDACTED]' : v1 - end - def msg2str(msg) case msg when ::String msg when ::Exception @@ -84,6 +90,6 @@ def severity_to_color(severity) SEVERITY_COLOR_MAP[severity.downcase.to_sym] end end -end \ No newline at end of file +end