airbrake-ruby 4.0.0 → 4.0.1

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: f02fa6e61f0c293426ab4b4c3347106dadba90a8
4
- data.tar.gz: aab5dbba3ec59829fb95b4b3d6a24c67a38023d7
3
+ metadata.gz: 681ed72fb1b600b723e7dbb48c607d37a58a1c71
4
+ data.tar.gz: 3afa4336efbf5c0aa621eeebc6d1e890a0af7254
5
5
  SHA512:
6
- metadata.gz: 5d4c7e5134c8fb761a469bc082518b920b0de8a6e1845b3e1b574a71bc33fab56e1e51235434a65d2e68b1069e78e397a2438b0b48e885c33afba503962a929a
7
- data.tar.gz: 01d60cea9501d88ca04b45c57a19d568e42a3bfb07e09ffbe23fb9a67e1dab02fc60c2bd1ab564aad164a40e28635a6fb47ec2d1baf5c8c2e13c4196e64eba99
6
+ metadata.gz: daadebdf259818ec34b172c694ea942416b498451461cdb09e728e28245fa0456dc8fe07fc000f01966650c6b567f7ec10cd46126c2d443e4d783c5670b29247
7
+ data.tar.gz: 8f2df8d80dbc8be84cf48a88678ee98ce4a538d02e995d63dfa1392dbb5acd0edd787f605b85f161b5131d20260e94345ae994fe77a3359a3c281b453bfc9804
data/lib/airbrake-ruby.rb CHANGED
@@ -165,7 +165,7 @@ module Airbrake
165
165
 
166
166
  raise Airbrake::Error, config.validation_error_message unless config.valid?
167
167
 
168
- Airbrake::Loggable.instance = Airbrake::Config.instance
168
+ Airbrake::Loggable.instance = config.logger
169
169
 
170
170
  @performance_notifier = PerformanceNotifier.new
171
171
  @notice_notifier = NoticeNotifier.new
@@ -5,13 +5,6 @@ module Airbrake
5
5
  # @api public
6
6
  # @since v1.0.0
7
7
  class Config
8
- @instance = new
9
-
10
- class << self
11
- # @return [Config]
12
- attr_accessor :instance
13
- end
14
-
15
8
  # @return [Integer] the project identificator. This value *must* be set.
16
9
  # @api public
17
10
  attr_accessor :project_id
@@ -102,6 +95,16 @@ module Airbrake
102
95
  # @since v3.2.0
103
96
  attr_accessor :performance_stats_flush_period
104
97
 
98
+ class << self
99
+ # @param [Config] new_instance
100
+ attr_writer :instance
101
+
102
+ # @return [Config]
103
+ def instance
104
+ @instance ||= new
105
+ end
106
+ end
107
+
105
108
  # @param [Hash{Symbol=>Object}] user_config the hash to be used to build the
106
109
  # config
107
110
  def initialize(user_config = {})
@@ -16,11 +16,14 @@ module Airbrake
16
16
  # @since v4.0.0
17
17
  # @api private
18
18
  module Loggable
19
- @instance = ::Logger.new(File::NULL)
20
-
21
19
  class << self
20
+ # @param [Logger] logger
21
+ attr_writer :instance
22
+
22
23
  # @return [Logger]
23
- attr_accessor :instance
24
+ def instance
25
+ @instance ||= ::Logger.new(File::NULL)
26
+ end
24
27
  end
25
28
 
26
29
  # @return [Logger] standard Ruby logger object
@@ -2,5 +2,5 @@
2
2
  # More information: http://semver.org/
3
3
  module Airbrake
4
4
  # @return [String] the library version
5
- AIRBRAKE_RUBY_VERSION = '4.0.0'.freeze
5
+ AIRBRAKE_RUBY_VERSION = '4.0.1'.freeze
6
6
  end
@@ -12,6 +12,17 @@ RSpec.describe Airbrake do
12
12
  end.to yield_with_args(Airbrake::Config)
13
13
  end
14
14
 
15
+ it "sets logger to Airbrake::Loggable" do
16
+ logger = Logger.new(File::NULL)
17
+ described_class.configure do |c|
18
+ c.project_id = 1
19
+ c.project_key = '123'
20
+ c.logger = logger
21
+ end
22
+
23
+ expect(Airbrake::Loggable.instance).to eql(logger)
24
+ end
25
+
15
26
  context "when user config doesn't contain a project id" do
16
27
  it "raises error" do
17
28
  expect { described_class.configure { |c| c.project_key = '1' } }.
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: airbrake-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.0
4
+ version: 4.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Airbrake Technologies, Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-02-25 00:00:00.000000000 Z
11
+ date: 2019-02-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rbtree3