All Projects → DannyBen → pretty_trace

DannyBen / pretty_trace

Licence: MIT License
Love Your Ruby's Backtrace

Programming Languages

ruby
36898 projects - #4 most used programming language

Projects that are alternatives of or similar to pretty trace

stack-inspector
A gdb command to inspect the size of objects on the stack
Stars: ✭ 57 (+338.46%)
Mutual labels:  debugging, backtrace
elm-monitor
Monitor your elm program with redux-devtools
Stars: ✭ 20 (+53.85%)
Mutual labels:  debugging
CrashLogger
A dll injected into process to dump stack when crashing.
Stars: ✭ 19 (+46.15%)
Mutual labels:  debugging
CSS-Lecture-And-Exercises
🎨 Get to know CSS! It's fun!
Stars: ✭ 11 (-15.38%)
Mutual labels:  debugging
WhatTheStack
See a pretty error screen when your Android app crashes
Stars: ✭ 240 (+1746.15%)
Mutual labels:  debugging
ae page objects
Page Objects for Capybara
Stars: ✭ 26 (+100%)
Mutual labels:  gem
filtered
Filters ActiveRecord queries in a nice way
Stars: ✭ 28 (+115.38%)
Mutual labels:  gem
dwex
DWARF Explorer - a GUI utility for navigating the DWARF debug information
Stars: ✭ 58 (+346.15%)
Mutual labels:  debugging
slabdbg
GDB plug-in that helps exploiting the Linux kernel's SLUB allocator
Stars: ✭ 55 (+323.08%)
Mutual labels:  debugging
pydbg
Python implementation of the Rust `dbg` macro
Stars: ✭ 85 (+553.85%)
Mutual labels:  debugging
slow-down
A centralized Redis-based lock to help you wait on throttled resources
Stars: ✭ 21 (+61.54%)
Mutual labels:  gem
pytest-faulthandler
py.test plugin that activates the fault handler module during testing
Stars: ✭ 27 (+107.69%)
Mutual labels:  debugging
rack-simple user agent
Rack::SimpleUserAgent is stupidly simple UA detector
Stars: ✭ 13 (+0%)
Mutual labels:  gem
rspec n
A ruby gem that runs RSpec N times.
Stars: ✭ 37 (+184.62%)
Mutual labels:  gem
yo-ruby
🌈 ✨ A super awesome Ruby wrapper of the Yo API.
Stars: ✭ 15 (+15.38%)
Mutual labels:  gem
XCMetricsAggregator
Automation tool for Xcode Metrics Organizer with AppleScript
Stars: ✭ 53 (+307.69%)
Mutual labels:  gem
r2lldb
radare2-lldb integration
Stars: ✭ 54 (+315.38%)
Mutual labels:  debugging
debug.cr
Debug macro for Crystal
Stars: ✭ 86 (+561.54%)
Mutual labels:  debugging
jquery-datatables
Jquery datatables ruby gems for assets pipeline
Stars: ✭ 73 (+461.54%)
Mutual labels:  gem
m3forth
m3forth is a forth cross-compiler for cortex-m3 ARM microcontrollers
Stars: ✭ 16 (+23.08%)
Mutual labels:  debugging

Pretty Trace - Pretty Errors and Backtrace

Gem Version Build Status Maintainability


Make your Ruby backtrace pretty again. Just require pretty_trace/enable in your ruby script, and errors will become clearer and more readable.


Install

$ gem install pretty_trace

Or with bundler:

# Just install, do not activate
gem 'pretty_trace'

# Or, install and enable
gem 'pretty_trace', require: 'pretty_trace/enable'

# Or, install, enable and enable trimming
gem 'pretty_trace', require: 'pretty_trace/enable-trim'

Example

Create this ruby file:

# test.rb
require "pretty_trace/enable-trim"
require "fileutils"
FileUtils.rm 'no_such_file'

Run it:

screenshot

Usage

The easiest way to use Pretty Trace is to require its activation script in your script:

require 'pretty_trace/enable'

From this point on, any exception will be formatted.

If you wish to show a trimmed version of the backtrace (where errors from the same file are collapsed into one line), require this script instead:

require 'pretty_trace/enable-trim'

If you prefer to have more control, you can configure these settings manually:

require 'pretty_trace'

# Exceptions here will not be formatted

PrettyTrace.enable
# Exceptions here will be formatted

PrettyTrace.disable
# Exceptions here will not be formatted

PrettyTrace.enable
PrettyTrace.trim
# Exceptions here will be formatted and trimmed

PrettyTrace.no_trim
# Exceptions here will not be trimmed

Configuration

Filtering specific paths

To filter out lines in the backtrace, use PrettyTrace.filter. This method accepts a single regular expression, or an array of regular expressions.

Note that you can call this method several times, and it will aggregate all your filters together.

require 'pretty_trace/enable'
PrettyTrace.filter /rails/
PrettyTrace.filter [/gem/, /lib/]

If you wish to temporarily disable Pretty Trace (for example, when you need to see the full trace paths), you can set the environment variable PRETTY_TRACE=off before running your script:

$ PRETTY_TRACE=off ruby myscript.rb

If you wish to temporarily disable trimming and filtering, you can set the environment variable PRETTY_TRACE=full before running your script:

$ PRETTY_TRACE=full ruby myscript.rb

Showing a debug tip

If you wish to see a debug tip, reminding you to set PRETTY_TRACE to full or off when an error occurs, use PrettyTrace.debug_tip:

require 'pretty_trace/enable'
PrettyTrace.debug_tip     # enable debug tip
PrettyTrace.no_debug_tip  # disable debug tip

Contributing / Support

If you experience any issue, have a question or a suggestion, or if you wish to contribute, feel free to open an issue.


Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].