Class: Mongo::Monitoring::SDAMLogSubscriber

Inherits:
Object
  • Object
show all
Includes:
Loggable
Defined in:
lib/mongo/monitoring/sdam_log_subscriber.rb

Overview

Subscribes to SDAM events and logs them.

Since:

  • 2.4.0

Constant Summary

Constants included from Loggable

Loggable::PREFIX

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Loggable

#log_debug, #log_error, #log_fatal, #log_info, #log_warn, #logger

Constructor Details

#initialize(options = {}) ⇒ SDAMLogSubscriber

Create the new log subscriber.

Examples:

Create the log subscriber.

SDAMLogSubscriber.new

Parameters:

  • options (Hash) (defaults to: {})

    The options.

Options Hash (options):

  • :logger (Logger)

    An optional custom logger.

Since:

  • 2.4.0



40
41
42
# File 'lib/mongo/monitoring/sdam_log_subscriber.rb', line 40

def initialize(options = {})
  @options = options
end

Instance Attribute Details

#optionsHash (readonly)

Returns options The options.

Returns:

  • (Hash)

    options The options.

Since:

  • 2.4.0



28
29
30
# File 'lib/mongo/monitoring/sdam_log_subscriber.rb', line 28

def options
  @options
end

Instance Method Details

#succeeded(event) ⇒ Object

Handle the SDAM succeeded event.

Examples:

Handle the event.

subscriber.succeeded(event)

Parameters:

  • event (Event)

    The event.

Since:

  • 2.4.0



52
53
54
# File 'lib/mongo/monitoring/sdam_log_subscriber.rb', line 52

def succeeded(event)
  log_event(event) if logger.debug?
end