rollbar_helper 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: df95b15b12d0921c2b333e8676d89427cc173127
4
- data.tar.gz: fdcdafa2ead440a29523ad6cef30a58f0f98d0f0
2
+ SHA256:
3
+ metadata.gz: 3188f0c479f3fcc8158ef0e660b53995a8123f84c62361c373ee11eeba01c248
4
+ data.tar.gz: 78e439c12122df2e3df02ad041a727aa9ca0dc49dec78e52a38a059154a92bde
5
5
  SHA512:
6
- metadata.gz: 4f9d322c825d367e3e6535f7fd4367671657082e73d70fe0d0a4292313e6a3c6abed868c43843d882d389416a347e4fa282f9993a13a1736c87c7097482ad385
7
- data.tar.gz: 6181ed540b397c0429eb2701ac7ce8610db5d3142c4d5799bf3f79225500730241f60d022ce55327ed0556bb6e4701853469be00d39b61d0dc76d986b3938a69
6
+ metadata.gz: c187bb5ec26c61942af3318452d2fbf06b4b5cacd754382fd409c525f98c61801a6a79d0bb64764d031a74187de6740ea426f45ee8f79b0ebff5fc35e4fdb0f9
7
+ data.tar.gz: 6e3fa33e29007565a9a211d5d61456799e285e2c751195147814db91a752c0cf25ed2ec1aa4b2bb578e60dd060a2cc4aed6ea71bde506e8105d0b2fbcc9c04ed
@@ -1,24 +1,57 @@
1
- class RollbarHelper
2
- VERSION = "0.2.0"
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
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(caller)
47
+ e.set_backtrace(callee)
14
48
  end
15
49
 
16
- if fingerprint.present?
17
- Rollbar.scope(:fingerprint => fingerprint).error(e, data)
50
+ unless fingerprint.nil?
51
+ ::Rollbar.scope(:fingerprint => fingerprint).send(level, e, data)
18
52
  else
19
- Rollbar.error(e, data)
53
+ ::Rollbar.send(level, e, data)
20
54
  end
21
55
  end
22
-
23
56
  end
24
57
  end
@@ -0,0 +1,3 @@
1
+ module RollbarHelper
2
+ VERSION = '0.3.0'
3
+ end
@@ -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.add_development_dependency "pry", "~> 0.11"
33
34
  spec.add_dependency "rollbar", "~> 2.13"
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.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Santiago Herrera
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-06-10 00:00:00.000000000 Z
11
+ date: 2018-10-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -52,6 +52,20 @@ 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
@@ -84,6 +98,7 @@ 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:
@@ -106,7 +121,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
106
121
  version: '0'
107
122
  requirements: []
108
123
  rubyforge_project:
109
- rubygems_version: 2.6.8
124
+ rubygems_version: 2.7.7
110
125
  signing_key:
111
126
  specification_version: 4
112
127
  summary: Displays a stacktrace in rollbar