Sha256: 3045abc178e6c3312a483672ee34325a068a76663fd22b8ab216e4cfe1820326

Contents?: true

Size: 496 Bytes

Versions: 1

Compression:

Stored size: 496 Bytes

Contents

module LogListener
  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
    # TODO proper logging
    puts "[datamapper - ERROR] #{e.class.name}: #{e.message}: #{message.inspect}}"
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
dm-rails-1.0.0.rc3 lib/dm-rails/railties/log_listener.rb