File tree Expand file tree Collapse file tree 5 files changed +12
-4
lines changed
Expand file tree Collapse file tree 5 files changed +12
-4
lines changed Original file line number Diff line number Diff line change 1+ ## Unreleased
2+
3+ - Skip creating ` LogEventBuffer ` if logging is not enabled ([ #2652 ] ( https://github.com/getsentry/sentry-ruby/pull/2652 ) )
4+
15## 5.25.0
26
37### Features
Original file line number Diff line number Diff line change @@ -42,7 +42,9 @@ def initialize(configuration)
4242
4343 @spotlight_transport = SpotlightTransport . new ( configuration ) if configuration . spotlight
4444
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
4648 end
4749
4850 # Applies the given scope's data to the event and sends it to Sentry.
@@ -114,7 +116,7 @@ def capture_envelope(envelope)
114116 def flush
115117 transport . flush if configuration . sending_to_dsn_allowed?
116118 spotlight_transport . flush if spotlight_transport
117- @log_event_buffer . flush
119+ @log_event_buffer & .flush
118120 end
119121
120122 # Initializes an Event object with the given exception. Returns `nil` if the exception's class is excluded from reporting.
Original file line number Diff line number Diff line change 1919 config . sdk_logger = logger
2020 config . background_worker_threads = 0
2121 config . max_log_events = max_log_events
22+ config . enable_logs = true
2223 end
2324
2425 Sentry . background_worker = Sentry ::BackgroundWorker . new ( Sentry . configuration )
Original file line number Diff line number Diff line change 103103 it "spawns new thread" do
104104 expect do
105105 subject . add_session ( session )
106- end . to change { Thread . list . count } . by ( 2 )
106+ end . to change { Thread . list . count } . by ( 1 )
107107
108108 expect ( subject . instance_variable_get ( :@thread ) ) . to be_a ( Thread )
109109 end
110110
111111 it "spawns only one thread" do
112112 expect do
113113 subject . add_session ( session )
114- end . to change { Thread . list . count } . by ( 2 )
114+ end . to change { Thread . list . count } . by ( 1 )
115115
116116 thread = subject . instance_variable_get ( :@thread )
117117 expect ( thread ) . to receive ( :alive? ) . and_return ( true )
Original file line number Diff line number Diff line change 354354 describe ".capture_log" do
355355 before do
356356 perform_basic_setup do |config |
357+ config . enable_logs = true
357358 config . traces_sample_rate = 1.0
358359 config . max_log_events = 1
359360 end
You can’t perform that action at this time.
0 commit comments