raygun4ruby 1.0.1 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/raygun.rb +5 -0
- data/lib/raygun/configuration.rb +60 -18
- data/lib/raygun/railtie.rb +2 -2
- data/lib/raygun/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b8b2d236a59db88c7bec66e710483eabd9b69a04
|
4
|
+
data.tar.gz: bbc45c14ccae5463bd0adb08ebe12ad0530efaee
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dd1c79d31a83cd4b862a58d9aced18f6499953178cbc46273259f7dff24422f0a99b99f1dc632cc2cc9f05b276280016bc44b8d51f8a58a4dd1d49fe82e61905
|
7
|
+
data.tar.gz: a985d74fc2e49892888f30fd43b8d270bb54532011f276ea727145278425cd5c9b11d6e767ebe9a2bc16083c17d69153ca4e38791ba266e7e5243c274ab807cb
|
data/lib/raygun.rb
CHANGED
@@ -6,6 +6,7 @@ require "logger"
|
|
6
6
|
require "json"
|
7
7
|
require "socket"
|
8
8
|
require "rack"
|
9
|
+
require "ostruct"
|
9
10
|
|
10
11
|
require "raygun/version"
|
11
12
|
require "raygun/configuration"
|
@@ -38,6 +39,10 @@ module Raygun
|
|
38
39
|
@configuration ||= Configuration.new
|
39
40
|
end
|
40
41
|
|
42
|
+
def default_configuration
|
43
|
+
configuration.defaults
|
44
|
+
end
|
45
|
+
|
41
46
|
def track_exception(exception_instance, env = {})
|
42
47
|
if should_report?(exception_instance)
|
43
48
|
log("[Raygun] Tracking Exception...")
|
data/lib/raygun/configuration.rb
CHANGED
@@ -1,35 +1,45 @@
|
|
1
1
|
module Raygun
|
2
2
|
class Configuration
|
3
3
|
|
4
|
+
def self.config_option(name)
|
5
|
+
define_method(name) do
|
6
|
+
read_value(name)
|
7
|
+
end
|
8
|
+
|
9
|
+
define_method("#{name}=") do |value|
|
10
|
+
set_value(name, value)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
4
14
|
# Your Raygun API Key - this can be found on your dashboard at Raygun.io
|
5
|
-
|
15
|
+
config_option :api_key
|
6
16
|
|
7
17
|
# Array of exception classes to ignore
|
8
|
-
|
18
|
+
config_option :ignore
|
9
19
|
|
10
20
|
# Version to use
|
11
|
-
|
21
|
+
config_option :version
|
12
22
|
|
13
23
|
# Custom Data to send with each exception
|
14
|
-
|
24
|
+
config_option :custom_data
|
15
25
|
|
16
26
|
# Logger to use when if we find an exception :)
|
17
|
-
|
27
|
+
config_option :logger
|
18
28
|
|
19
|
-
# Should we
|
20
|
-
|
29
|
+
# Should we actually report exceptions to Raygun? (Usually disabled in Development mode, for instance)
|
30
|
+
config_option :enable_reporting
|
21
31
|
|
22
32
|
# Failsafe logger (for exceptions that happen when we're attempting to report exceptions)
|
23
|
-
|
33
|
+
config_option :failsafe_logger
|
24
34
|
|
25
35
|
# Which controller method should we call to find out the affected user?
|
26
|
-
|
36
|
+
config_option :affected_user_method
|
27
37
|
|
28
38
|
# Which methods should we try on the affected user object in order to get an identifier
|
29
|
-
|
39
|
+
config_option :affected_user_identifier_methods
|
30
40
|
|
31
41
|
# Which parameter keys should we filter out by default?
|
32
|
-
|
42
|
+
config_option :filter_parameters
|
33
43
|
|
34
44
|
# Exception classes to ignore by default
|
35
45
|
IGNORE_DEFAULT = ['ActiveRecord::RecordNotFound',
|
@@ -42,19 +52,51 @@ module Raygun
|
|
42
52
|
|
43
53
|
DEFAULT_FILTER_PARAMETERS = [ :password, :card_number, :cvv ]
|
44
54
|
|
55
|
+
attr_reader :defaults
|
56
|
+
|
45
57
|
def initialize
|
58
|
+
@config_values = {}
|
59
|
+
|
46
60
|
# set default attribute values
|
47
|
-
@
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
61
|
+
@defaults = OpenStruct.new({
|
62
|
+
ignore: IGNORE_DEFAULT,
|
63
|
+
custom_data: {},
|
64
|
+
enable_reporting: true,
|
65
|
+
affected_user_method: :current_user,
|
66
|
+
affected_user_identifier_methods: [ :email, :username, :id ],
|
67
|
+
filter_parameters: DEFAULT_FILTER_PARAMETERS
|
68
|
+
})
|
53
69
|
end
|
54
70
|
|
55
71
|
def [](key)
|
56
|
-
|
72
|
+
read_value(key)
|
73
|
+
end
|
74
|
+
|
75
|
+
def []=(key, value)
|
76
|
+
set_value(key, value)
|
57
77
|
end
|
58
78
|
|
79
|
+
def silence_reporting
|
80
|
+
!enable_reporting
|
81
|
+
end
|
82
|
+
|
83
|
+
def silence_reporting=(value)
|
84
|
+
self.enable_reporting = !value
|
85
|
+
end
|
86
|
+
|
87
|
+
private
|
88
|
+
|
89
|
+
def read_value(name)
|
90
|
+
if @config_values.has_key?(name)
|
91
|
+
@config_values[name]
|
92
|
+
else
|
93
|
+
@defaults.send(name)
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
def set_value(name, value)
|
98
|
+
@config_values[name] = value
|
99
|
+
end
|
100
|
+
|
59
101
|
end
|
60
102
|
end
|
data/lib/raygun/railtie.rb
CHANGED
@@ -19,8 +19,8 @@ class Raygun::Railtie < Rails::Railtie
|
|
19
19
|
end
|
20
20
|
|
21
21
|
config.to_prepare do
|
22
|
-
Raygun.
|
23
|
-
Raygun.
|
22
|
+
Raygun.default_configuration.logger = Rails.logger
|
23
|
+
Raygun.default_configuration.enable_reporting = Rails.env.production?
|
24
24
|
end
|
25
25
|
|
26
26
|
rake_tasks do
|
data/lib/raygun/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: raygun4ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mindscape
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-05-
|
12
|
+
date: 2014-05-26 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: httparty
|