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



19
20
21
22
23
# File 'lib/rocket_job/extensions/mongo/logging.rb', line 19

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

#prefix(event) ⇒ Object



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

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

#started(event) ⇒ Object



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

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

#succeeded(event) ⇒ Object



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

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