Sha256: d218c429b595031460e6401b52ef55c6d537edc7d1dfa7a25928ce2679f10c74

Contents?: true

Size: 706 Bytes

Versions: 27

Compression:

Stored size: 706 Bytes

Contents

require 'mongo/monitoring/command_log_subscriber'

module Mongo
  class Monitoring
    class CommandLogSubscriber
      include SemanticLogger::Loggable
      self.logger.name = 'Mongo'

      def started(event)
        @event_command = event.command
      end

      def succeeded(event)
        logger.debug(message: prefix(event), duration: (event.duration * 1000), payload: @event_command)
      end

      def failed(event)
        logger.debug(message: "#{prefix(event)} Failed: #{event.message}", duration: (event.duration * 1000), payload: @event_command)
      end

      def prefix(event)
        "#{event.address.to_s} | #{event.database_name}.#{event.command_name}"
      end
    end
  end
end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
rocketjob-3.0.0.rc3 lib/rocket_job/extensions/mongo/logging.rb
rocketjob-3.0.0.rc2 lib/rocket_job/extensions/mongo/logging.rb
rocketjob-3.0.0.rc1 lib/rocket_job/extensions/mongo/logging.rb
rocketjob-3.0.0.beta3 lib/rocket_job/extensions/mongo/logging.rb
rocketjob-3.0.0.beta2 lib/rocket_job/extensions/mongo/logging.rb
rocketjob-3.0.0.beta lib/rocket_job/extensions/mongo/logging.rb
rocketjob-3.0.0.alpha lib/rocket_job/extensions/mongo/logging.rb