aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2019-07-15 17:21:06 +0200
committerDavid Heinemeier Hansson <david@loudthinking.com>2019-07-15 17:21:06 +0200
commit0dc6527a8be9e2cf74162574b56ef3e84c4b6969 (patch)
tree5d693b32f502f15432a33cdb2e3124df5cbcd7b5 /activesupport
parent79ef8310bec5eb2e3d05134b36bccda821703652 (diff)
downloadrails-0dc6527a8be9e2cf74162574b56ef3e84c4b6969.tar.gz
rails-0dc6527a8be9e2cf74162574b56ef3e84c4b6969.tar.bz2
rails-0dc6527a8be9e2cf74162574b56ef3e84c4b6969.zip
Inline anemic log guard
This is the only use of it
Diffstat (limited to 'activesupport')
-rw-r--r--activesupport/lib/active_support/cache.rb9
1 files changed, 3 insertions, 6 deletions
diff --git a/activesupport/lib/active_support/cache.rb b/activesupport/lib/active_support/cache.rb
index e055135bb4..a5063d0784 100644
--- a/activesupport/lib/active_support/cache.rb
+++ b/activesupport/lib/active_support/cache.rb
@@ -678,18 +678,15 @@ module ActiveSupport
end
def instrument(operation, key, options = nil)
- log { "Cache #{operation}: #{normalize_key(key, options)}#{options.blank? ? "" : " (#{options.inspect})"}" }
+ if logger && logger.debug? && !silence?
+ logger.debug "Cache #{operation}: #{normalize_key(key, options)}#{options.blank? ? "" : " (#{options.inspect})"}"
+ end
payload = { key: key }
payload.merge!(options) if options.is_a?(Hash)
ActiveSupport::Notifications.instrument("cache_#{operation}.active_support", payload) { yield(payload) }
end
- def log
- return unless logger && logger.debug? && !silence?
- logger.debug(yield)
- end
-
def handle_expired_entry(entry, key, options)
if entry && entry.expired?
race_ttl = options[:race_condition_ttl].to_i