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
+
1
5
## 5.25.0
2
6
3
7
### Features
Original file line number Diff line number Diff line change @@ -42,7 +42,9 @@ def initialize(configuration)
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 @@ def capture_envelope(envelope)
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.
Original file line number Diff line number Diff line change 19
19
config . sdk_logger = logger
20
20
config . background_worker_threads = 0
21
21
config . max_log_events = max_log_events
22
+ config . enable_logs = true
22
23
end
23
24
24
25
Sentry . background_worker = Sentry ::BackgroundWorker . new ( Sentry . configuration )
Original file line number Diff line number Diff line change 103
103
it "spawns new thread" do
104
104
expect do
105
105
subject . add_session ( session )
106
- end . to change { Thread . list . count } . by ( 2 )
106
+ end . to change { Thread . list . count } . by ( 1 )
107
107
108
108
expect ( subject . instance_variable_get ( :@thread ) ) . to be_a ( Thread )
109
109
end
110
110
111
111
it "spawns only one thread" do
112
112
expect do
113
113
subject . add_session ( session )
114
- end . to change { Thread . list . count } . by ( 2 )
114
+ end . to change { Thread . list . count } . by ( 1 )
115
115
116
116
thread = subject . instance_variable_get ( :@thread )
117
117
expect ( thread ) . to receive ( :alive? ) . and_return ( true )
Original file line number Diff line number Diff line change 354
354
describe ".capture_log" do
355
355
before do
356
356
perform_basic_setup do |config |
357
+ config . enable_logs = true
357
358
config . traces_sample_rate = 1.0
358
359
config . max_log_events = 1
359
360
end
You can’t perform that action at this time.
0 commit comments