Class: TwitterFriendly::ASLogSubscriber
- Inherits:
-
ActiveSupport::LogSubscriber
- Object
- ActiveSupport::LogSubscriber
- TwitterFriendly::ASLogSubscriber
- Includes:
- Logging
- Defined in:
- lib/twitter_friendly/log_subscriber.rb
Instance Method Summary collapse
Methods included from Logging
logger, logger=, #truncated_payload
Instance Method Details
#cache_any(event) ⇒ Object
103 104 105 106 107 108 109 110 111 112 113 |
# File 'lib/twitter_friendly/log_subscriber.rb', line 103 def cache_any(event) debug do payload = event.payload operation = payload[:super_operation] == :fetch ? :fetch : payload[:name] hit = %i(read fetch).include?(operation.to_sym) && payload[:hit] ? ' (Hit)' : '' name = " AS::#{operation.capitalize}#{hit} #{payload[:key].split('__')[1]} (#{event.duration.round(1)}ms)" name = color(name, MAGENTA, true) # :name, :expires_in, :super_operation, :hit, :race_condition_ttl, :tf_super_operation, :tf_super_super_operation "#{name} #{(payload.slice(:key).inspect)}" end end |