Class: Rails::Sequel::Railties::LogSubscriber

Inherits:
ActiveSupport::LogSubscriber
  • Object
show all
Defined in:
lib/rails3_sequel/railties/log_subscriber.rb

Instance Method Summary collapse

Instance Method Details

#sql(event) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/rails3_sequel/railties/log_subscriber.rb', line 5

def sql(event)
  name = '%s (%.1fms)' % [event.payload[:name], event.payload[: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