Class: Sequel::Railties::LogSubscriber
- Inherits:
-
ActiveSupport::LogSubscriber
- Object
- ActiveSupport::LogSubscriber
- Sequel::Railties::LogSubscriber
- Defined in:
- lib/sequel-rails/railties/log_subscriber.rb
Instance Method Summary collapse
Instance Method Details
#logger ⇒ Object
24 25 26 |
# File 'lib/sequel-rails/railties/log_subscriber.rb', line 24 def logger ::Rails::Sequel.configuration.logger end |
#odd? ⇒ Boolean
20 21 22 |
# File 'lib/sequel-rails/railties/log_subscriber.rb', line 20 def odd? @odd_or_even = !@odd_or_even end |
#sql(event) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/sequel-rails/railties/log_subscriber.rb', line 6 def sql(event) name = '%s (%.1fms)' % [event.payload[:name], event.duration] sql = event.payload[:sql].squeeze(' ') if odd? name = color(name, :cyan, true) sql = color(sql, nil, true) else name = color(name, :magenta, true) end debug " #{name} #{sql}" end |