Pretty your exception backtrace.
Pretty your exception backtrace.
Add this line to your application's Gemfile:
gem 'pretty_backtrace'And then execute:
$ bundleOr install it yourself as:
$ gem install pretty_backtraceUse like that:
require 'pretty_backtrace'
PrettyBacktrace.enable
def recursive n
str = "Hi #{n}!! " * 128
if n > 0
recursive n - 1
else
raise "bottom of recursive"
end
end
recursive 3and you can see prettier backtrace (you can see local variable names and values).
test.rb:10:in `recursive' (n = 0, str = "Hi 0!! Hi 0!! Hi 0...): bottom of recursive (RuntimeError)
from test.rb:9:in `recursive' (n = 1, str = "Hi 1!! Hi 1!! Hi 1...)
from test.rb:9:in `recursive' (n = 2, str = "Hi 2!! Hi 2!! Hi 2...)
from test.rb:9:in `recursive' (n = 3, str = "Hi 3!! Hi 3!! Hi 3...)
from test.rb:15:in `'You only need to require "pretty_backtrace/enable" to eliminate "PrettyBacktrace.enable call".
PrettyBacktrace::CONFIG can change behaviour. See source code files for details.
You can use multi-line mode with the following configuration.
PrettyBacktrace.multi_line = trueMulti-line mode enable to show file contents and all variables (and pointing values) in each lines like that:
…There are no spec tests. I love to get your contributions!
git checkout -b my-new-feature)git commit -am 'Add some feature')git push origin my-new-feature)No open issues yet, or sync has not completed.