Sha256: e28b081b5fbfe88ede8cf0504b49a5f92b506cd431da30b2d1e1899972298953

Contents?: true

Size: 345 Bytes

Versions: 2

Compression:

Stored size: 345 Bytes

Contents

module Mongoid

  class LogSubscriber < ActiveSupport::LogSubscriber
    def query(event)
      payload = event.payload
      runtime = ("%.4fms" % event.duration)
      Moped::Loggable.log_operations(payload[:prefix], payload[:ops], runtime)
    end

    def logger
      Moped.logger
    end
  end
end

Mongoid::LogSubscriber.attach_to :moped

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
sepastian-mongoid-rails4-4.0.1.alpha lib/mongoid/log_subscriber.rb
sepastian-mongoid-rails4-4.0.0.alpha lib/mongoid/log_subscriber.rb