Module: Rails::Sequel::Logging

Defined in:
lib/rails3_sequel/logging.rb

Instance Method Summary collapse

Instance Method Details

#log_duration(duration, message) ⇒ Object



4
5
6
7
8
9
10
11
12
13
# File 'lib/rails3_sequel/logging.rb', line 4

def log_duration (duration, message)
  @controller_runtime ||= 0
  @controller_runtime += duration
  ActiveSupport::Notifications.instrument('sql.sequel', 
    :sql => message,
    :name => 'SQL',
    :duration => duration * 1000
  )
  super
end

#log_each(level, message) ⇒ Object



15
16
17
18
19
# File 'lib/rails3_sequel/logging.rb', line 15

def log_each (level, message)
  # Rails logging is handled by the log subscriber
  less_rails = @loggers - [Rails.logger]
  less_rails.each { |logger| logger.send(level, message) }
end

#reset_runtimeObject



21
22
23
24
# File 'lib/rails3_sequel/logging.rb', line 21

def reset_runtime
  rt, @controller_runtime = @controller_runtime, 0
  rt.to_f * 1000
end