Class: ExTwitter::LogSubscriber
- Inherits:
-
ActiveSupport::LogSubscriber
- Object
- ActiveSupport::LogSubscriber
- ExTwitter::LogSubscriber
- Defined in:
- lib/ex_twitter/log_subscriber.rb
Instance Method Summary collapse
- #cache_any(event) ⇒ Object
- #call(event) ⇒ Object
-
#initialize ⇒ LogSubscriber
constructor
A new instance of LogSubscriber.
Constructor Details
#initialize ⇒ LogSubscriber
Returns a new instance of LogSubscriber.
8 9 10 11 |
# File 'lib/ex_twitter/log_subscriber.rb', line 8 def initialize super @odd = false end |
Instance Method Details
#cache_any(event) ⇒ Object
13 14 15 16 17 18 19 20 |
# File 'lib/ex_twitter/log_subscriber.rb', line 13 def cache_any(event) return unless logger.debug? payload = event.payload name = "#{payload.delete(:name)} (#{event.duration.round(1)}ms)" name = colorize_payload_name(name, payload[:name], AS: true) debug { "#{name} #{(payload.inspect)}" } end |
#call(event) ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/ex_twitter/log_subscriber.rb', line 31 def call(event) return unless logger.debug? payload = event.payload name = "#{payload.delete(:operation)} (#{event.duration.round(1)}ms)" name = colorize_payload_name(name, payload[:name]) # sql = color(sql, sql_color(sql), true) key = payload.delete(:key) debug { "#{name} #{key} #{(payload.inspect)}" } end |