Sha256: 94e327f49f41e3eafb152de55b1cb703b61a483e8f51913454e8cb19769123f0

Contents?: true

Size: 784 Bytes

Versions: 17

Compression:

Stored size: 784 Bytes

Contents

require 'mongo/monitoring/command_log_subscriber'

module Mongo
  class Monitoring
    class CommandLogSubscriber
      include SemanticLogger::Loggable
      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} | #{event.database_name}.#{event.command_name}"
      end
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
rocketjob-5.1.1 lib/rocket_job/extensions/mongo/logging.rb
rocketjob-5.1.0 lib/rocket_job/extensions/mongo/logging.rb
rocketjob-5.0.0 lib/rocket_job/extensions/mongo/logging.rb
rocketjob-5.0.0.rc1 lib/rocket_job/extensions/mongo/logging.rb
rocketjob-5.0.0.beta4 lib/rocket_job/extensions/mongo/logging.rb
rocketjob-5.0.0.beta3 lib/rocket_job/extensions/mongo/logging.rb
rocketjob-5.0.0.beta2 lib/rocket_job/extensions/mongo/logging.rb
rocketjob-5.0.0.beta lib/rocket_job/extensions/mongo/logging.rb
rocketjob-4.3.0.beta2 lib/rocket_job/extensions/mongo/logging.rb
rocketjob-4.3.0.beta lib/rocket_job/extensions/mongo/logging.rb
rocketjob-4.2.0 lib/rocket_job/extensions/mongo/logging.rb
rocketjob-4.1.1 lib/rocket_job/extensions/mongo/logging.rb
rocketjob-4.1.0 lib/rocket_job/extensions/mongo/logging.rb
rocketjob-4.0.0 lib/rocket_job/extensions/mongo/logging.rb
rocketjob-3.5.2 lib/rocket_job/extensions/mongo/logging.rb
rocketjob-3.5.1 lib/rocket_job/extensions/mongo/logging.rb
rocketjob-3.5.0 lib/rocket_job/extensions/mongo/logging.rb