Module: LogListener

Defined in:
lib/dm-rails/railties/log_listener.rb

Instance Method Summary collapse

Instance Method Details

#log(message) ⇒ Object



27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/dm-rails/railties/log_listener.rb', line 27

def log(message)
  ActiveSupport::Notifications.instrument('sql.data_mapper',
    :name          => 'SQL',
    :sql           => message.query, # TODO think about changing the key to :query
    :start         => message.start,
    :duration      => message.duration,
    :connection_id => self.object_id
  )
  super
rescue Exception => e
  ::DataMapper.logger.error "[datamapper] #{e.class.name}: #{e.message}: #{message.inspect}}"
end