sentry-raven 1.2.2 → 1.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/raven/base.rb +1 -0
- data/lib/raven/cli.rb +21 -18
- data/lib/raven/configuration.rb +13 -13
- data/lib/raven/event.rb +3 -1
- data/lib/raven/instance.rb +0 -3
- data/lib/raven/logger.rb +5 -11
- data/lib/raven/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: 656c9303a15859cbba85c2e9d08003f57df11c7c
|
4
|
+
data.tar.gz: e3c32559a3f11b62a4d49471d7bd7dab968fe5ab
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c3357a60cdd946579a473778671fffcb461ec7a3c572244a020f4b39a901b92091a744f055a455d1ef3ef004c45c989ffb7e0042e67a1e38cbacdb1e1dd0e859
|
7
|
+
data.tar.gz: 7565bc3e31786e9eb670c22e0fd23946c8f1dffc39a743645a6710988b1966d936e95d11598c0901fde1edca1b2e07bb36b0b0810c319552722b6d5910e81fdc
|
data/lib/raven/base.rb
CHANGED
data/lib/raven/cli.rb
CHANGED
@@ -1,29 +1,32 @@
|
|
1
1
|
module Raven
|
2
2
|
class CLI
|
3
|
-
def self.test(dsn = nil)
|
4
|
-
|
3
|
+
def self.test(dsn = nil, silent = false)
|
4
|
+
if silent
|
5
|
+
Raven.configuration.logger = ::Logger.new(nil)
|
6
|
+
else
|
7
|
+
logger = ::Logger.new(STDOUT)
|
8
|
+
logger.level = ::Logger::ERROR
|
9
|
+
logger.formatter = proc do |_severity, _datetime, _progname, msg|
|
10
|
+
"-> #{msg}\n"
|
11
|
+
end
|
5
12
|
|
6
|
-
|
7
|
-
logger.level = ::Logger::ERROR
|
8
|
-
logger.formatter = proc do |_severity, _datetime, _progname, msg|
|
9
|
-
"-> #{msg}\n"
|
13
|
+
Raven.configuration.logger = logger
|
10
14
|
end
|
11
15
|
|
12
|
-
Raven.configuration.logger = logger
|
13
16
|
Raven.configuration.timeout = 5
|
14
17
|
Raven.configuration.dsn = dsn if dsn
|
15
18
|
|
16
19
|
# wipe out env settings to ensure we send the event
|
17
20
|
unless Raven.configuration.capture_in_current_environment?
|
18
21
|
env_name = Raven.configuration.environments.pop || 'production'
|
19
|
-
|
22
|
+
Raven.logger.debug "Setting environment to #{env_name}"
|
20
23
|
Raven.configuration.current_environment = env_name
|
21
24
|
end
|
22
25
|
|
23
26
|
Raven.configuration.verify!
|
24
27
|
|
25
|
-
|
26
|
-
|
28
|
+
Raven.logger.debug "Sending a test event:"
|
29
|
+
Raven.logger.debug ""
|
27
30
|
|
28
31
|
begin
|
29
32
|
1 / 0
|
@@ -33,24 +36,24 @@ module Raven
|
|
33
36
|
|
34
37
|
if evt && !(evt.is_a? Thread)
|
35
38
|
if evt.is_a? Hash
|
36
|
-
|
39
|
+
Raven.logger.debug "-> event ID: #{evt[:event_id]}"
|
37
40
|
else
|
38
|
-
|
41
|
+
Raven.logger.debug "-> event ID: #{evt.id}"
|
39
42
|
end
|
40
43
|
elsif evt #async configuration
|
41
44
|
if evt.value.is_a? Hash
|
42
|
-
|
45
|
+
Raven.logger.debug "-> event ID: #{evt.value[:event_id]}"
|
43
46
|
else
|
44
|
-
|
47
|
+
Raven.logger.debug "-> event ID: #{evt.value.id}"
|
45
48
|
end
|
46
49
|
else
|
47
|
-
|
48
|
-
|
50
|
+
Raven.logger.debug ""
|
51
|
+
Raven.logger.debug "An error occurred while attempting to send the event."
|
49
52
|
exit 1
|
50
53
|
end
|
51
54
|
|
52
|
-
|
53
|
-
|
55
|
+
Raven.logger.debug ""
|
56
|
+
Raven.logger.debug "Done!"
|
54
57
|
end
|
55
58
|
end
|
56
59
|
end
|
data/lib/raven/configuration.rb
CHANGED
@@ -22,7 +22,7 @@ module Raven
|
|
22
22
|
attr_accessor :project_id
|
23
23
|
|
24
24
|
# Project directory root
|
25
|
-
|
25
|
+
attr_reader :project_root
|
26
26
|
|
27
27
|
# Encoding type for event bodies
|
28
28
|
attr_reader :encoding
|
@@ -85,7 +85,7 @@ module Raven
|
|
85
85
|
attr_reader :async
|
86
86
|
|
87
87
|
# Optional Proc, called when the Sentry server cannot be contacted for any reason
|
88
|
-
|
88
|
+
attr_reader :transport_failure_callback
|
89
89
|
|
90
90
|
# Directories to be recognized as part of your app. e.g. if you
|
91
91
|
# have an `engines` dir at the root of your project, you may want
|
@@ -98,7 +98,7 @@ module Raven
|
|
98
98
|
# will report exceptions even when they are rescued by these middlewares.
|
99
99
|
attr_accessor :rails_report_rescued_exceptions
|
100
100
|
# Deprecated accessor
|
101
|
-
|
101
|
+
attr_reader :catch_debugged_exceptions
|
102
102
|
|
103
103
|
# Turns on ActiveSupport breadcrumbs integration
|
104
104
|
attr_accessor :rails_activesupport_breadcrumbs
|
@@ -174,20 +174,20 @@ module Raven
|
|
174
174
|
|
175
175
|
if uri.user
|
176
176
|
# DSN-style string
|
177
|
-
|
178
|
-
|
179
|
-
|
177
|
+
self.project_id = uri_path.pop
|
178
|
+
self.public_key = uri.user
|
179
|
+
self.secret_key = uri.password
|
180
180
|
end
|
181
181
|
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
182
|
+
self.scheme = uri.scheme
|
183
|
+
self.host = uri.host
|
184
|
+
self.port = uri.port if uri.port
|
185
|
+
self.path = uri_path.join('/')
|
186
186
|
|
187
187
|
# For anyone who wants to read the base server string
|
188
|
-
@server = "#{
|
189
|
-
@server << ":#{
|
190
|
-
@server <<
|
188
|
+
@server = "#{scheme}://#{host}"
|
189
|
+
@server << ":#{port}" unless port == { 'http' => 80, 'https' => 443 }[scheme]
|
190
|
+
@server << path
|
191
191
|
end
|
192
192
|
|
193
193
|
def encoding=(encoding)
|
data/lib/raven/event.rb
CHANGED
@@ -26,7 +26,7 @@ module Raven
|
|
26
26
|
attr_reader :id
|
27
27
|
attr_accessor :project, :message, :timestamp, :time_spent, :level, :logger,
|
28
28
|
:culprit, :server_name, :release, :modules, :extra, :tags, :context, :configuration,
|
29
|
-
:checksum, :fingerprint
|
29
|
+
:checksum, :fingerprint, :environment
|
30
30
|
|
31
31
|
def initialize(init = {})
|
32
32
|
@configuration = Raven.configuration
|
@@ -49,6 +49,7 @@ module Raven
|
|
49
49
|
@tags = {}
|
50
50
|
@checksum = nil
|
51
51
|
@fingerprint = nil
|
52
|
+
@environment = @configuration.current_environment
|
52
53
|
|
53
54
|
yield self if block_given?
|
54
55
|
|
@@ -220,6 +221,7 @@ module Raven
|
|
220
221
|
data[:culprit] = @culprit if @culprit
|
221
222
|
data[:server_name] = @server_name if @server_name
|
222
223
|
data[:release] = @release if @release
|
224
|
+
data[:environment] = @environment if @environment
|
223
225
|
data[:fingerprint] = @fingerprint if @fingerprint
|
224
226
|
data[:modules] = @modules if @modules
|
225
227
|
data[:extra] = @extra if @extra
|
data/lib/raven/instance.rb
CHANGED
data/lib/raven/logger.rb
CHANGED
@@ -5,14 +5,6 @@ module Raven
|
|
5
5
|
class Logger
|
6
6
|
LOG_PREFIX = "** [Raven] ".freeze
|
7
7
|
|
8
|
-
LEVELS = {
|
9
|
-
:debug => ::Logger::DEBUG,
|
10
|
-
:info => ::Logger::INFO,
|
11
|
-
:warn => ::Logger::WARN,
|
12
|
-
:error => ::Logger::ERROR,
|
13
|
-
:fatal => ::Logger::FATAL
|
14
|
-
}.freeze
|
15
|
-
|
16
8
|
[
|
17
9
|
:fatal,
|
18
10
|
:error,
|
@@ -21,12 +13,14 @@ module Raven
|
|
21
13
|
:debug,
|
22
14
|
].each do |level|
|
23
15
|
define_method level do |*args, &block|
|
24
|
-
msg = args[0] # Block-level default args is a 1.9 feature
|
25
|
-
msg ||= block.call if block
|
26
16
|
logger = Raven.configuration[:logger]
|
27
17
|
logger = ::Logger.new(STDOUT) if logger.nil?
|
18
|
+
return unless logger
|
19
|
+
|
20
|
+
msg = args[0] # Block-level default args is a 1.9 feature
|
21
|
+
msg ||= block.call if block
|
28
22
|
|
29
|
-
logger.
|
23
|
+
logger.send(level, "sentry") { "#{LOG_PREFIX}#{msg}" }
|
30
24
|
end
|
31
25
|
end
|
32
26
|
end
|
data/lib/raven/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sentry-raven
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sentry Team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-08-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|