class Rack::Logjam::Filters::Json
Public Instance Methods
render()
click to toggle source
# File lib/rack/logjam/filters/json.rb, line 8 def render return content if blank_content? apply_filters json_path.to_json end
Protected Instance Methods
apply_filters()
click to toggle source
# File lib/rack/logjam/filters/json.rb, line 20 def apply_filters filters.each do |j_path, action, length| json_path.gsub!( j_path ) do |val| method_name = "#{action}_#{val.class.name.downcase}" if respond_to?( method_name, true ) send( method_name, val, length ) else "[#{action.upcase}ED: #{val.class.name}]" end end end end
blank_content?()
click to toggle source
# File lib/rack/logjam/filters/json.rb, line 16 def blank_content? content.nil? || content.strip.empty? end
json_path()
click to toggle source
# File lib/rack/logjam/filters/json.rb, line 53 def json_path @json_path ||= ::JsonPath.for( content ) end
redact_nilclass( val, *args )
click to toggle source
# File lib/rack/logjam/filters/json.rb, line 33 def redact_nilclass( val, *args ) nil end
redact_string( val, *args )
click to toggle source
# File lib/rack/logjam/filters/json.rb, line 41 def redact_string( val, *args ) (val.nil? || val.empty?) ? val : "[REDACTED]" end
truncate_nilclass( val, length )
click to toggle source
# File lib/rack/logjam/filters/json.rb, line 37 def truncate_nilclass( val, length ) nil end
truncate_string( val, length )
click to toggle source
# File lib/rack/logjam/filters/json.rb, line 47 def truncate_string( val, length ) (val.nil? || val.empty?) ? val : "#{val[0..length]}...[TRUNCATED]..." end