sentry-ruby-core 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: 893c349e407be28a6cff343d0fd46e9bd398879faae1cae8baf43b7da6e53667
4
- data.tar.gz: 00efb1f46016d1db1756ff6ccdd15ae0af27d48278c5d1cec4a302a3805e80c4
3
+ metadata.gz: 73b47f292ec9010020ba711010ad2c3496cacccbda703da5260a3ec1723d5f32
4
+ data.tar.gz: 65df577369b281f3e1d1d9335e78786a800947c2014b35608d88c863458f24ca
5
5
  SHA512:
6
- metadata.gz: 5c41f116d7724304a3d39350d8d6636bfe6f03e40feff724b89e30436bb5c79269f6486ebe0fe1ee0d4722a0ad33c6b19e1579bf35c66faace7b1f963cc45204
7
- data.tar.gz: 2c3b81765ea431073d60c41c289204d3bfae2ad7b6754147ef80414bd40c6ecd11d79a4efbf4af3fd148439840205f6f0ca6756a40c349553d370e545d4b0d62
6
+ metadata.gz: '09db8d1895227a0d4cb09855ab683e2f92ecb55870c1edf590960b186b0839896dbbfbfe1e4cd5822cfaf6181769475fab89740854a1aa82b0ed9f98d32efee7'
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-core
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
@@ -15,14 +15,14 @@ dependencies:
15
15
  requirements:
16
16
  - - '='
17
17
  - !ruby/object:Gem::Version
18
- version: 5.25.0
18
+ version: 5.26.0
19
19
  type: :runtime
20
20
  prerelease: false
21
21
  version_requirements: !ruby/object:Gem::Requirement
22
22
  requirements:
23
23
  - - '='
24
24
  - !ruby/object:Gem::Version
25
- version: 5.25.0
25
+ version: 5.26.0
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: concurrent-ruby
28
28
  requirement: !ruby/object:Gem::Requirement
@@ -123,6 +123,7 @@ files:
123
123
  - lib/sentry/session.rb
124
124
  - lib/sentry/session_flusher.rb
125
125
  - lib/sentry/span.rb
126
+ - lib/sentry/std_lib_logger.rb
126
127
  - lib/sentry/structured_logger.rb
127
128
  - lib/sentry/test_helper.rb
128
129
  - lib/sentry/threaded_periodic_worker.rb