Sha256: df7c7b6788f55edba27686b1cbd2bd64e0dc05fc5206abed6d5e6bf15c534a01
Contents?: true
Size: 638 Bytes
Versions: 1
Compression:
Stored size: 638 Bytes
Contents
require "mongoid-rails-instrumentation/railtie" require "mongoid-rails-instrumentation/log_subscriber" module MongoidRailsInstrumentation def self.instrument(klass) klass.class_eval do def logging(operations) instrument_start = (logger = Moped.logger) && logger.debug? && Time.new yield ensure if instrument_start instrument_end = 1000 * (Time.new.to_f - instrument_start.to_f) MopedLogSubscriber.runtime += instrument_end MopedLogSubscriber.query_count += 1 log_operations(logger, operations, instrument_end) end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
mongoid-rails-instrumentation-0.0.1 | lib/mongoid-rails-instrumentation.rb |