sentry-ruby 5.25.0 → 5.26.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d7397a94c353821b827cd429f7e75cf1663f4bc3aa40e4407eef9f2f726a632f
4
- data.tar.gz: 00efb1f46016d1db1756ff6ccdd15ae0af27d48278c5d1cec4a302a3805e80c4
3
+ metadata.gz: eb03eb536d1060c3a097a1ff3726ae71c8ffbd0012580d75c491665e054ac7c1
4
+ data.tar.gz: 65df577369b281f3e1d1d9335e78786a800947c2014b35608d88c863458f24ca
5
5
  SHA512:
6
- metadata.gz: de1e9f756456d324ce92be08686ae0b0101d306f539bd2c0212490d5cc3816e80fca8ed7a76f697edf58950e5445e65a4101934de05251559b3042edc3bc2a75
7
- data.tar.gz: 2c3b81765ea431073d60c41c289204d3bfae2ad7b6754147ef80414bd40c6ecd11d79a4efbf4af3fd148439840205f6f0ca6756a40c349553d370e545d4b0d62
6
+ metadata.gz: b4e398e02a8fe619afc8982760c290a168785c4557dca30767fbeb039032d7907135e84d0598a5ac90b7b1cfb8413ceda83ebe4647702ba5c10c613ff0543574
7
+ data.tar.gz: 285a3e0f650a41bcb6cc4539f48c7efcb9bc3442f31c76f301089c4672e6d9c790f407dd9d53db4e216df4eacd9be019b5bc46e453437fa1614aa48555541c9a
data/Rakefile CHANGED
@@ -6,16 +6,13 @@ CLOBBER.include "pkg"
6
6
  require "bundler/gem_helper"
7
7
  Bundler::GemHelper.install_tasks(name: "sentry-ruby")
8
8
 
9
- require "rspec/core/rake_task"
9
+ require_relative "../lib/sentry/test/rake_tasks"
10
10
 
11
11
  ISOLATED_SPECS = "spec/isolated/**/*_spec.rb"
12
12
 
13
- RSpec::Core::RakeTask.new(:spec).tap do |task|
14
- task.exclude_pattern = ISOLATED_SPECS
15
- end
13
+ Sentry::Test::RakeTasks.define_spec_tasks(
14
+ isolated_specs_pattern: ISOLATED_SPECS,
15
+ spec_exclude_pattern: ISOLATED_SPECS
16
+ )
16
17
 
17
- RSpec::Core::RakeTask.new(:isolated_specs).tap do |task|
18
- task.pattern = ISOLATED_SPECS
19
- end
20
-
21
- task default: [:spec, :isolated_specs]
18
+ task default: [:spec, :"spec:isolated"]
data/lib/sentry/client.rb CHANGED
@@ -42,7 +42,9 @@ module Sentry
42
42
 
43
43
  @spotlight_transport = SpotlightTransport.new(configuration) if configuration.spotlight
44
44
 
45
- @log_event_buffer = LogEventBuffer.new(configuration, self).start
45
+ if configuration.enable_logs
46
+ @log_event_buffer = LogEventBuffer.new(configuration, self).start
47
+ end
46
48
  end
47
49
 
48
50
  # Applies the given scope's data to the event and sends it to Sentry.
@@ -114,7 +116,7 @@ module Sentry
114
116
  def flush
115
117
  transport.flush if configuration.sending_to_dsn_allowed?
116
118
  spotlight_transport.flush if spotlight_transport
117
- @log_event_buffer.flush
119
+ @log_event_buffer&.flush
118
120
  end
119
121
 
120
122
  # Initializes an Event object with the given exception. Returns `nil` if the exception's class is excluded from reporting.
@@ -0,0 +1,50 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Sentry
4
+ # Ruby Logger support Add commentMore actions
5
+ # intercepts any logger instance and send the log to Sentry too.
6
+ module StdLibLogger
7
+ SEVERITY_MAP = {
8
+ 0 => :debug,
9
+ 1 => :info,
10
+ 2 => :warn,
11
+ 3 => :error,
12
+ 4 => :fatal
13
+ }.freeze
14
+
15
+ def add(severity, message = nil, progname = nil, &block)
16
+ result = super
17
+
18
+ return unless Sentry.initialized? && Sentry.get_current_hub
19
+
20
+ # exclude sentry SDK logs -- to prevent recursive log action,
21
+ # do not process internal logs again
22
+ if message.nil? && progname != Sentry::Logger::PROGNAME
23
+
24
+ # handle different nature of Ruby Logger class:
25
+ # inspo from Sentry::Breadcrumb::SentryLogger
26
+ if block_given?
27
+ message = yield
28
+ else
29
+ message = progname
30
+ end
31
+
32
+ message = message.to_s.strip
33
+
34
+ if !message.nil? && message != Sentry::Logger::PROGNAME && method = SEVERITY_MAP[severity]
35
+ Sentry.logger.send(method, message)
36
+ end
37
+ end
38
+
39
+ result
40
+ end
41
+ end
42
+ end
43
+
44
+ Sentry.register_patch(:logger) do |config|
45
+ if config.enable_logs
46
+ ::Logger.prepend(Sentry::StdLibLogger)
47
+ else
48
+ config.sdk_logger.warn(":logger patch enabled but `enable_logs` is turned off - skipping applying patch")
49
+ end
50
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Sentry
4
- VERSION = "5.25.0"
4
+ VERSION = "5.26.0"
5
5
  end
data/lib/sentry-ruby.rb CHANGED
@@ -690,3 +690,4 @@ require "sentry/puma"
690
690
  require "sentry/graphql"
691
691
  require "sentry/faraday"
692
692
  require "sentry/excon"
693
+ require "sentry/std_lib_logger"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sentry-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.25.0
4
+ version: 5.26.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sentry Team
@@ -129,6 +129,7 @@ files:
129
129
  - lib/sentry/session.rb
130
130
  - lib/sentry/session_flusher.rb
131
131
  - lib/sentry/span.rb
132
+ - lib/sentry/std_lib_logger.rb
132
133
  - lib/sentry/structured_logger.rb
133
134
  - lib/sentry/test_helper.rb
134
135
  - lib/sentry/threaded_periodic_worker.rb
@@ -154,15 +155,15 @@ files:
154
155
  - lib/sentry/version.rb
155
156
  - sentry-ruby-core.gemspec
156
157
  - sentry-ruby.gemspec
157
- homepage: https://github.com/getsentry/sentry-ruby/tree/5.25.0/sentry-ruby
158
+ homepage: https://github.com/getsentry/sentry-ruby/tree/5.26.0/sentry-ruby
158
159
  licenses:
159
160
  - MIT
160
161
  metadata:
161
- homepage_uri: https://github.com/getsentry/sentry-ruby/tree/5.25.0/sentry-ruby
162
- source_code_uri: https://github.com/getsentry/sentry-ruby/tree/5.25.0/sentry-ruby
163
- changelog_uri: https://github.com/getsentry/sentry-ruby/blob/5.25.0/CHANGELOG.md
162
+ homepage_uri: https://github.com/getsentry/sentry-ruby/tree/5.26.0/sentry-ruby
163
+ source_code_uri: https://github.com/getsentry/sentry-ruby/tree/5.26.0/sentry-ruby
164
+ changelog_uri: https://github.com/getsentry/sentry-ruby/blob/5.26.0/CHANGELOG.md
164
165
  bug_tracker_uri: https://github.com/getsentry/sentry-ruby/issues
165
- documentation_uri: http://www.rubydoc.info/gems/sentry-ruby/5.25.0
166
+ documentation_uri: http://www.rubydoc.info/gems/sentry-ruby/5.26.0
166
167
  rdoc_options: []
167
168
  require_paths:
168
169
  - lib