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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bc76647e919f5e837ef8abf2cbf0521e11193220
4
- data.tar.gz: 978b72587b050a72524c5f6c559d2a88a8aaa74f
3
+ metadata.gz: 656c9303a15859cbba85c2e9d08003f57df11c7c
4
+ data.tar.gz: e3c32559a3f11b62a4d49471d7bd7dab968fe5ab
5
5
  SHA512:
6
- metadata.gz: 9c001fe837c066e6c31798f2559848b136bfc5b06a305d7760935114a9efb88d8dc6997b421d0d09ac7e97069bccc7112592c724c2b1bd3b946f29ff4536d9e2
7
- data.tar.gz: 01cd432010f844dacca7fb3fdface7e4421e528e0efcf56bc3d9ee566a2ebfd9e2840e293a3cb493675d8179ff66795ccb2c5c9a84c5f6a9b6a2cd8b3e2a6c55
6
+ metadata.gz: c3357a60cdd946579a473778671fffcb461ec7a3c572244a020f4b39a901b92091a744f055a455d1ef3ef004c45c989ffb7e0042e67a1e38cbacdb1e1dd0e859
7
+ data.tar.gz: 7565bc3e31786e9eb670c22e0fd23946c8f1dffc39a743645a6710988b1966d936e95d11598c0901fde1edca1b2e07bb36b0b0810c319552722b6d5910e81fdc
@@ -22,6 +22,7 @@ require 'raven/utils/deep_merge'
22
22
  require 'raven/instance'
23
23
 
24
24
  require 'forwardable'
25
+ require 'English'
25
26
 
26
27
  module Raven
27
28
  AVAILABLE_INTEGRATIONS = %w[delayed_job railties sidekiq rack rake].freeze
@@ -1,29 +1,32 @@
1
1
  module Raven
2
2
  class CLI
3
- def self.test(dsn = nil)
4
- require 'logger'
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
- logger = ::Logger.new(STDOUT)
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
- puts "Setting environment to #{env_name}"
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
- puts "Sending a test event:"
26
- puts ""
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
- puts "-> event ID: #{evt[:event_id]}"
39
+ Raven.logger.debug "-> event ID: #{evt[:event_id]}"
37
40
  else
38
- puts "-> event ID: #{evt.id}"
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
- puts "-> event ID: #{evt.value[:event_id]}"
45
+ Raven.logger.debug "-> event ID: #{evt.value[:event_id]}"
43
46
  else
44
- puts "-> event ID: #{evt.value.id}"
47
+ Raven.logger.debug "-> event ID: #{evt.value.id}"
45
48
  end
46
49
  else
47
- puts ""
48
- puts "An error occurred while attempting to send the event."
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
- puts ""
53
- puts "Done!"
55
+ Raven.logger.debug ""
56
+ Raven.logger.debug "Done!"
54
57
  end
55
58
  end
56
59
  end
@@ -22,7 +22,7 @@ module Raven
22
22
  attr_accessor :project_id
23
23
 
24
24
  # Project directory root
25
- attr_accessor :project_root
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
- attr_accessor :transport_failure_callback
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
- attr_accessor :catch_debugged_exceptions
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
- @project_id = uri_path.pop
178
- @public_key = uri.user
179
- @secret_key = uri.password
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
- @scheme = uri.scheme
183
- @host = uri.host
184
- @port = uri.port if uri.port
185
- @path = uri_path.join('/')
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 = "#{@scheme}://#{@host}"
189
- @server << ":#{@port}" unless @port == { 'http' => 80, 'https' => 443 }[@scheme]
190
- @server << @path
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)
@@ -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
@@ -1,6 +1,3 @@
1
- require 'raven/base'
2
- require 'English'
3
-
4
1
  module Raven
5
2
  # A copy of Raven's base module class methods, minus some of the integration
6
3
  # and global hooks since it's meant to be used explicitly. Useful for
@@ -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.add(LEVELS[level], "#{LOG_PREFIX}#{msg}", "sentry") if logger
23
+ logger.send(level, "sentry") { "#{LOG_PREFIX}#{msg}" }
30
24
  end
31
25
  end
32
26
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
  module Raven
3
3
  # Freezing this constant breaks in 1.9.x
4
- VERSION = "1.2.2" # rubocop:disable Style/MutableConstant
4
+ VERSION = "1.2.3" # rubocop:disable Style/MutableConstant
5
5
  end
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.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-07-22 00:00:00.000000000 Z
11
+ date: 2016-08-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday