Is there a way to get a better format of output with byebug? When I print objects the output is a little hard to read, would be better with colors similar to Awesome Print
.
There is no native option on byebug to format the output with colors, but there is a Gem you can use to colorize some of byebug output for ease of readability, which I think is what you are aiming here.
Please follow this link to see instructions on how to install byebug-color-printer Gem. https://github.com/ahmadsherif/byebug-color-printer
Or you could use pry. https://github.com/pry/pry :)
Let me know how this works for you. I hope it helps.
Consider using a new Ruby debugging tool called debug.rb.
It supports syntax highlighting and many more out-of-the-box.
Also, it is worth mentioning that it is developed by the Ruby core team.
Just place binding.break
anywhere in your codebase.
Here is an example:
Also, it is a default Rails debugger starting from version 7.
Notes:
require 'debug'
q # quit command
Sources:
If you add awesome_print
to your project (via the Gemfile if you use bundler), then ap will be available to you inside byebug
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With