diff --git a/lib/timber/current_context.rb b/lib/timber/current_context.rb index b3195e32..e23fffc1 100644 --- a/lib/timber/current_context.rb +++ b/lib/timber/current_context.rb @@ -6,7 +6,7 @@ module Timber class CurrentContext class ContextAlreadyAddedError < StandardError def initialize(context) - super("Context of type #{context.class.name} has already been added") + super("Context of type #{context.class.name} has already been added: #{context.as_json.inspect}") end end diff --git a/lib/timber/probes/active_support_log_subscriber/active_record.rb b/lib/timber/probes/active_support_log_subscriber/active_record.rb index 3dacc67d..80eea310 100644 --- a/lib/timber/probes/active_support_log_subscriber/active_record.rb +++ b/lib/timber/probes/active_support_log_subscriber/active_record.rb @@ -3,6 +3,7 @@ module Probes class ActiveSupportLogSubscriber < Probe module ActiveRecord def self.sql(log_subscriber, event, &_block) + Config.logger.warn("Adding sql context for #{event.payload[:sql]}") context1 = Contexts::SQLQueries::ActiveRecord.new(log_subscriber, event) context2 = Contexts::SQLQueries::ActiveRecordSpecific.new(log_subscriber, event) CurrentContext.add(context1, context2) { yield }