lib/memolog.rb in memolog-0.4.9 vs lib/memolog.rb in memolog-0.5.0
- old
+ new
@@ -46,18 +46,18 @@
yield
ensure
logdevs.pop unless config.debug
end
- def dump
+ def dump(parse_json: false)
return if logdevs.empty?
beginning = logdevs.last.string.length - config.log_size_limit
beginning = 0 if beginning.negative?
dump = logdevs.last.string.slice(beginning, config.log_size_limit).presence
- dump && config.parse_json ? JSON.parse(dump) : dump
+ dump && parse_json ? JSON.parse(dump) : dump
rescue JSON::ParserError
dump
end
end