pretty_trace 0.2.4 → 0.2.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +21 -17
- data/lib/pretty_trace/handler.rb +5 -0
- data/lib/pretty_trace/module_methods.rb +8 -0
- data/lib/pretty_trace/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a7895d1287b0efe660fd6807cc8b26c6bde79d96aef0030b4da2fe97bd0b77cf
|
4
|
+
data.tar.gz: b0618c23b25b8cd17fe82ac77b4daace01828163c46a2f5af370e587f55e1b4f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f90fb665503e3a4e273783874a0c032b4224453913ed7f7b1c4d9c11a8f5d8e7d3860e7805c6931221c21feb7a8a12d68cb441af4bc24bffde01120ba8bad854
|
7
|
+
data.tar.gz: 184e2517630768749a2aef7b051f9c7e75859ff09bec1fcd200d5140e2f040dcc0618d5e634575e9d1098ceb25fb34b42f6e95535cd9eb84ffad597000b9d7da
|
data/README.md
CHANGED
@@ -1,9 +1,7 @@
|
|
1
|
-
Pretty Trace - Pretty Errors and Backtrace
|
2
|
-
==================================================
|
1
|
+
# Pretty Trace - Pretty Errors and Backtrace
|
3
2
|
|
4
3
|
[![Gem Version](https://badge.fury.io/rb/pretty_trace.svg)](https://badge.fury.io/rb/pretty_trace)
|
5
|
-
[![Build Status](https://
|
6
|
-
[![BCH compliance](https://bettercodehub.com/edge/badge/DannyBen/pretty_trace?branch=master)](https://bettercodehub.com/results/DannyBen/pretty_trace)
|
4
|
+
[![Build Status](https://github.com/DannyBen/pretty_trace/workflows/Test/badge.svg)](https://github.com/DannyBen/pretty_trace/actions?query=workflow%3ATest)
|
7
5
|
[![Maintainability](https://api.codeclimate.com/v1/badges/c9db6ec58ec7ac1484aa/maintainability)](https://codeclimate.com/github/DannyBen/pretty_trace/maintainability)
|
8
6
|
|
9
7
|
---
|
@@ -14,10 +12,9 @@ in your ruby script, and errors will become clearer and more readable.
|
|
14
12
|
---
|
15
13
|
|
16
14
|
|
17
|
-
Install
|
18
|
-
--------------------------------------------------
|
15
|
+
## Install
|
19
16
|
|
20
|
-
```
|
17
|
+
```shell
|
21
18
|
$ gem install pretty_trace
|
22
19
|
```
|
23
20
|
|
@@ -35,8 +32,7 @@ gem 'pretty_trace', require: 'pretty_trace/enable-trim'
|
|
35
32
|
```
|
36
33
|
|
37
34
|
|
38
|
-
Example
|
39
|
-
--------------------------------------------------
|
35
|
+
## Example
|
40
36
|
|
41
37
|
### Create this ruby file:
|
42
38
|
|
@@ -52,8 +48,7 @@ FileUtils.rm 'no_such_file'
|
|
52
48
|
![screenshot](/screenshot.gif)
|
53
49
|
|
54
50
|
|
55
|
-
Usage
|
56
|
-
--------------------------------------------------
|
51
|
+
## Usage
|
57
52
|
|
58
53
|
The easiest way to use Pretty Trace is to require its activation script in
|
59
54
|
your script:
|
@@ -94,8 +89,9 @@ PrettyTrace.no_trim
|
|
94
89
|
```
|
95
90
|
|
96
91
|
|
97
|
-
Configuration
|
98
|
-
|
92
|
+
## Configuration
|
93
|
+
|
94
|
+
### Filtering specific paths
|
99
95
|
|
100
96
|
To filter out lines in the backtrace, use `PrettyTrace.filter`. This method
|
101
97
|
accepts a single regular expression, or an array of regular expressions.
|
@@ -113,20 +109,28 @@ If you wish to temporarily disable Pretty Trace (for example, when you need
|
|
113
109
|
to see the full trace paths), you can set the environment variable
|
114
110
|
`PRETTY_TRACE=off` before running your script:
|
115
111
|
|
116
|
-
```
|
112
|
+
```shell
|
117
113
|
$ PRETTY_TRACE=off ruby myscript.rb
|
118
114
|
```
|
119
115
|
|
120
116
|
If you wish to temporarily disable trimming and filtering, you can set the
|
121
117
|
environment variable `PRETTY_TRACE=full` before running your script:
|
122
118
|
|
123
|
-
```
|
119
|
+
```shell
|
124
120
|
$ PRETTY_TRACE=full ruby myscript.rb
|
125
121
|
```
|
126
122
|
|
123
|
+
### Showing a debug tip
|
124
|
+
|
125
|
+
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`:
|
126
|
+
|
127
|
+
```ruby
|
128
|
+
require 'pretty_trace/enable'
|
129
|
+
PrettyTrace.debug_tip # enable debug tip
|
130
|
+
PrettyTrace.no_debug_tip # disable debug tip
|
131
|
+
```
|
127
132
|
|
128
|
-
Contributing / Support
|
129
|
-
--------------------------------------------------
|
133
|
+
## Contributing / Support
|
130
134
|
|
131
135
|
If you experience any issue, have a question or a suggestion, or if you wish
|
132
136
|
to contribute, feel free to [open an issue][issues].
|
data/lib/pretty_trace/handler.rb
CHANGED
@@ -54,6 +54,11 @@ module PrettyTrace
|
|
54
54
|
else
|
55
55
|
puts "\n%{blue}#{exception.class}\n%{red}#{message}%{reset}\n" % colors
|
56
56
|
end
|
57
|
+
|
58
|
+
if options[:debug_tip] and ENV['PRETTY_TRACE'] != 'full'
|
59
|
+
puts "\nTIP: Run with %{cyan}PRETTY_TRACE=full%{reset} (or %{cyan}off%{reset}) for debug information" % colors
|
60
|
+
end
|
61
|
+
|
57
62
|
$stdout.flush
|
58
63
|
# :nocov:
|
59
64
|
end
|
@@ -15,6 +15,14 @@ module PrettyTrace
|
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
18
|
+
def self.debug_tip
|
19
|
+
Handler.instance.options[:debug_tip] = true
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.no_debug_tip
|
23
|
+
Handler.instance.options[:debug_tip] = false
|
24
|
+
end
|
25
|
+
|
18
26
|
def self.trim
|
19
27
|
Handler.instance.options[:trim] = true
|
20
28
|
end
|
data/lib/pretty_trace/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pretty_trace
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Danny Ben Shitrit
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-05-01 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Display clean and colorful error messages and backtrace
|
14
14
|
email: db@dannyben.com
|