File tree Expand file tree Collapse file tree 1 file changed +7
-9
lines changed
sentry-rails/lib/sentry/rails Expand file tree Collapse file tree 1 file changed +7
-9
lines changed Original file line number Diff line number Diff line change @@ -33,6 +33,10 @@ class Configuration
3333 end
3434 end
3535 end
36+
37+ after ( :configured ) do
38+ rails . structured_logging . enabled = enable_logs if rails . structured_logging . enabled . nil?
39+ end
3640 end
3741
3842 module Rails
@@ -183,7 +187,7 @@ def initialize(parent_config = nil)
183187 @db_query_source_threshold_ms = 100
184188 @active_support_logger_subscription_items = Sentry ::Rails ::ACTIVE_SUPPORT_LOGGER_SUBSCRIPTION_ITEMS_DEFAULT . dup
185189 @active_job_report_on_retry_error = false
186- @structured_logging = StructuredLoggingConfiguration . new ( parent_config )
190+ @structured_logging = StructuredLoggingConfiguration . new
187191 end
188192 end
189193
@@ -192,30 +196,24 @@ class StructuredLoggingConfiguration
192196 # @return [Boolean]
193197 attr_accessor :enabled
194198
195- private :enabled
196-
197199 # Hash of components to subscriber classes for structured logging
198200 # @return [Hash<Symbol, Class>]
199201 attr_accessor :subscribers
200202
201- # @return [Sentry::Configuration]
202- attr_reader :parent_config
203-
204203 DEFAULT_SUBSCRIBERS = {
205204 active_record : Sentry ::Rails ::LogSubscribers ::ActiveRecordSubscriber ,
206205 action_controller : Sentry ::Rails ::LogSubscribers ::ActionControllerSubscriber
207206 } . freeze
208207
209- def initialize ( parent_config )
208+ def initialize
210209 @enabled = nil
211210 @subscribers = DEFAULT_SUBSCRIBERS . dup
212- @parent_config = parent_config
213211 end
214212
215213 # Returns true if structured logging should be enabled.
216214 # @return [Boolean]
217215 def enabled?
218- enabled . nil? ? parent_config . enable_logs : enabled
216+ enabled
219217 end
220218 end
221219 end
You can’t perform that action at this time.
0 commit comments