rollbar_helper 0.0.4 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/README.md +11 -4
- data/lib/rollbar_helper/version.rb +3 -0
- data/lib/rollbar_helper.rb +41 -8
- data/rollbar_helper.gemspec +3 -2
- metadata +24 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 45016049bfc7fea331fe1718c7a39c632c7aca38f3df4aa70ac97ca8c6e2b820
|
4
|
+
data.tar.gz: 2f940d6a1d6a39ca65af8e3e25c9ce9a422fb093b2da65219fd79516f96d3651
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 799e7561dd05166a40d527b0d6e7c1c191fb1c3b5e40dd292261aeffc6c8daf2ba6603acc8e9610995050ee51ddfd70669ded4fa74492b8d59aa2e01b40b794a
|
7
|
+
data.tar.gz: 989d22b2883cb81a1e3645ed15ffa49b29b34e7136737ea6dcd4a27f530da23b9461226166a25c61db0f6c9a5eb6afb06a16690d6e60662d35950e63c5b8b12c
|
data/README.md
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
# RollbarHelper
|
2
2
|
|
3
|
-
|
3
|
+
When you call `Rollbar.error('description')`, rollbar doesn't provide a stacktrace, just the "description" error. To find exactly where this error was generated, one has to search the entire codebase for `"description"`.
|
4
4
|
|
5
|
-
|
5
|
+
This gem allows you to call `RollbarHelper.error('description')` and get a stacktrace on https://rollbar.com pointing where in the code it was exactly generated.
|
6
6
|
|
7
7
|
## Installation
|
8
8
|
|
@@ -22,7 +22,14 @@ Or install it yourself as:
|
|
22
22
|
|
23
23
|
## Usage
|
24
24
|
|
25
|
-
|
25
|
+
Keep your `gem 'rollbar'` dependency and your rollbar configuration.
|
26
|
+
|
27
|
+
Instead of calling `Rollbar.error(...)`, call
|
28
|
+
```ruby
|
29
|
+
RollbarHelper.error(...)
|
30
|
+
```
|
31
|
+
|
32
|
+
`...` could be a string or an Exception
|
26
33
|
|
27
34
|
## Development
|
28
35
|
|
@@ -32,7 +39,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
32
39
|
|
33
40
|
## Contributing
|
34
41
|
|
35
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
42
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/bodyshopbidsdotcom/rollbar_helper. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
36
43
|
|
37
44
|
|
38
45
|
## License
|
data/lib/rollbar_helper.rb
CHANGED
@@ -1,24 +1,57 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
require 'rollbar'
|
2
|
+
require 'rollbar_helper/version'
|
3
|
+
|
4
|
+
module RollbarHelper
|
5
|
+
LEVELS = [
|
6
|
+
:critical,
|
7
|
+
:debug,
|
8
|
+
:error,
|
9
|
+
:info,
|
10
|
+
:warning,
|
11
|
+
]
|
3
12
|
|
4
13
|
class << self
|
14
|
+
def critical(obj, fingerprint: nil, **data)
|
15
|
+
log(:critical, obj, :callee => caller, fingerprint: fingerprint, **data)
|
16
|
+
end
|
17
|
+
|
18
|
+
def debug(obj, fingerprint: nil, **data)
|
19
|
+
log(:debug, obj, :callee => caller, fingerprint: fingerprint, **data)
|
20
|
+
end
|
5
21
|
|
6
|
-
def error(obj, fingerprint: nil)
|
22
|
+
def error(obj, fingerprint: nil, **data)
|
23
|
+
log(:error, obj, :callee => caller, fingerprint: fingerprint, **data)
|
24
|
+
end
|
25
|
+
|
26
|
+
def info(obj, fingerprint: nil, **data)
|
27
|
+
log(:info, obj, :callee => caller, fingerprint: fingerprint, **data)
|
28
|
+
end
|
29
|
+
|
30
|
+
def warn(obj, fingerprint: nil, **data)
|
31
|
+
log(:warning, obj, :callee => caller, fingerprint: fingerprint, **data)
|
32
|
+
end
|
33
|
+
|
34
|
+
def warning(obj, fingerprint: nil, **data)
|
35
|
+
log(:warning, obj, :callee => caller, fingerprint: fingerprint, **data)
|
36
|
+
end
|
37
|
+
|
38
|
+
def log(level, obj, callee: caller, fingerprint: nil, **data)
|
39
|
+
level = level.to_sym
|
40
|
+
raise ArgumentError, 'Log level is not supported' unless LEVELS.include?(level)
|
7
41
|
e = nil
|
8
42
|
|
9
43
|
if obj.is_a?(Exception)
|
10
44
|
e = obj
|
11
45
|
else
|
12
46
|
e = StandardError.new(obj.to_s)
|
13
|
-
e.set_backtrace(
|
47
|
+
e.set_backtrace(callee)
|
14
48
|
end
|
15
49
|
|
16
|
-
|
17
|
-
Rollbar.scope(:fingerprint => fingerprint).
|
50
|
+
unless fingerprint.nil?
|
51
|
+
::Rollbar.scope(:fingerprint => fingerprint).send(level, e, data)
|
18
52
|
else
|
19
|
-
Rollbar.
|
53
|
+
::Rollbar.send(level, e, data)
|
20
54
|
end
|
21
55
|
end
|
22
|
-
|
23
56
|
end
|
24
57
|
end
|
data/rollbar_helper.gemspec
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# coding: utf-8
|
2
2
|
lib = File.expand_path('../lib', __FILE__)
|
3
3
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require 'rollbar_helper'
|
4
|
+
require 'rollbar_helper/version'
|
5
5
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
spec.name = "rollbar_helper"
|
@@ -30,5 +30,6 @@ Gem::Specification.new do |spec|
|
|
30
30
|
spec.add_development_dependency "bundler", "~> 1.14"
|
31
31
|
spec.add_development_dependency "rake", "~> 10.0"
|
32
32
|
spec.add_development_dependency "rspec", "~> 3.0"
|
33
|
-
spec.
|
33
|
+
spec.add_development_dependency "pry", "~> 0.11"
|
34
|
+
spec.add_dependency "rollbar", "~> 3.2"
|
34
35
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rollbar_helper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Santiago Herrera
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-10-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -52,21 +52,35 @@ dependencies:
|
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '3.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: pry
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0.11'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0.11'
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
70
|
name: rollbar
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
58
72
|
requirements:
|
59
73
|
- - "~>"
|
60
74
|
- !ruby/object:Gem::Version
|
61
|
-
version: '2
|
75
|
+
version: '3.2'
|
62
76
|
type: :runtime
|
63
77
|
prerelease: false
|
64
78
|
version_requirements: !ruby/object:Gem::Requirement
|
65
79
|
requirements:
|
66
80
|
- - "~>"
|
67
81
|
- !ruby/object:Gem::Version
|
68
|
-
version: '2
|
69
|
-
description:
|
82
|
+
version: '3.2'
|
83
|
+
description:
|
70
84
|
email:
|
71
85
|
- santi.4096@gmail.com
|
72
86
|
executables: []
|
@@ -84,13 +98,14 @@ files:
|
|
84
98
|
- bin/console
|
85
99
|
- bin/setup
|
86
100
|
- lib/rollbar_helper.rb
|
101
|
+
- lib/rollbar_helper/version.rb
|
87
102
|
- rollbar_helper.gemspec
|
88
103
|
homepage: https://github.com/santi-h/rollbar_helper
|
89
104
|
licenses:
|
90
105
|
- MIT
|
91
106
|
metadata:
|
92
107
|
allowed_push_host: https://rubygems.org
|
93
|
-
post_install_message:
|
108
|
+
post_install_message:
|
94
109
|
rdoc_options: []
|
95
110
|
require_paths:
|
96
111
|
- lib
|
@@ -105,9 +120,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
105
120
|
- !ruby/object:Gem::Version
|
106
121
|
version: '0'
|
107
122
|
requirements: []
|
108
|
-
|
109
|
-
|
110
|
-
signing_key:
|
123
|
+
rubygems_version: 3.2.3
|
124
|
+
signing_key:
|
111
125
|
specification_version: 4
|
112
126
|
summary: Displays a stacktrace in rollbar
|
113
127
|
test_files: []
|