lib/distribute_reads.rb in distribute_reads-0.3.1 vs lib/distribute_reads.rb in distribute_reads-0.3.2

- old
+ new

@@ -12,19 +12,19 @@ class Error < StandardError; end class TooMuchLag < Error; end class NoReplicasAvailable < Error; end class << self - attr_accessor :by_default - attr_accessor :default_options + attr_accessor :by_default, :default_options, :eager_load attr_writer :logger end self.by_default = false self.default_options = { failover: true, lag_failover: false } + self.eager_load = false def self.logger unless defined?(@logger) @logger = ActiveRecord::Base.logger end @@ -96,14 +96,14 @@ end end def self.log(message) if logger - logger.info("[distribute_reads] #{message}") + logger.info { "[distribute_reads] #{message}" } # show location like Active Record source = backtrace_cleaner.clean(caller.lazy).first - logger.info(" ↳ #{source}") if source + logger.info { " ↳ #{source}" } if source end end # private def self.backtrace_cleaner