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



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

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

#prefix(event) ⇒ Object



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

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

#started(event) ⇒ Object



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

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

#succeeded(event) ⇒ Object



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

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