Class: Mongo::Monitoring::CommandLogSubscriber

Inherits:
Object
  • Object
show all
Includes:
SemanticLogger::Loggable
Defined in:
lib/rocket_job/extensions/mongo/logging.rb

Instance Method Summary collapse

Instance Method Details

#failed(event) ⇒ Object



23
24
25
26
27
# File 'lib/rocket_job/extensions/mongo/logging.rb', line 23

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

#prefix(event) ⇒ Object



30
31
32
# File 'lib/rocket_job/extensions/mongo/logging.rb', line 30

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

#started(event) ⇒ Object



11
12
13
# File 'lib/rocket_job/extensions/mongo/logging.rb', line 11

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

#succeeded(event) ⇒ Object



16
17
18
19
20
# File 'lib/rocket_job/extensions/mongo/logging.rb', line 16

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