Sha256: 75b26a35dc9e1931a4d0f9b115db64b3d5fe3ce0123ca9860bcaa41e68c249ef

Contents?: true

Size: 784 Bytes

Versions: 20

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

20 entries across 20 versions & 1 rubygems

Version Path
rocketjob-6.1.0 lib/rocket_job/extensions/mongo/logging.rb
rocketjob-6.0.3 lib/rocket_job/extensions/mongo/logging.rb
rocketjob-6.0.2 lib/rocket_job/extensions/mongo/logging.rb
rocketjob-6.0.1 lib/rocket_job/extensions/mongo/logging.rb
rocketjob-6.0.0 lib/rocket_job/extensions/mongo/logging.rb
rocketjob-6.0.0.rc3 lib/rocket_job/extensions/mongo/logging.rb
rocketjob-6.0.0.rc2 lib/rocket_job/extensions/mongo/logging.rb
rocketjob-6.0.0.rc1 lib/rocket_job/extensions/mongo/logging.rb
rocketjob-5.4.1 lib/rocket_job/extensions/mongo/logging.rb
rocketjob-5.4.0 lib/rocket_job/extensions/mongo/logging.rb
rocketjob-5.4.0.beta2 lib/rocket_job/extensions/mongo/logging.rb
rocketjob-5.4.0.beta1 lib/rocket_job/extensions/mongo/logging.rb
rocketjob-5.3.3 lib/rocket_job/extensions/mongo/logging.rb
rocketjob-5.3.2 lib/rocket_job/extensions/mongo/logging.rb
rocketjob-5.3.1 lib/rocket_job/extensions/mongo/logging.rb
rocketjob-5.3.0 lib/rocket_job/extensions/mongo/logging.rb
rocketjob-5.2.0 lib/rocket_job/extensions/mongo/logging.rb
rocketjob-5.2.0.beta3 lib/rocket_job/extensions/mongo/logging.rb
rocketjob-5.2.0.beta2 lib/rocket_job/extensions/mongo/logging.rb
rocketjob-5.2.0.beta1 lib/rocket_job/extensions/mongo/logging.rb