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



37
38
39
# File 'lib/mongo/monitoring/sdam_log_subscriber.rb', line 37

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

Instance Attribute Details

#optionsHash (readonly)

Returns options The options.

Returns:

  • (Hash)

    options The options.

Since:

  • 2.4.0



25
26
27
# File 'lib/mongo/monitoring/sdam_log_subscriber.rb', line 25

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



49
50
51
# File 'lib/mongo/monitoring/sdam_log_subscriber.rb', line 49

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