class Mongo::Monitoring::UnifiedSdamLogSubscriber

Subscribes to SDAM events and logs them.

@since 2.11.0 @api experimental

Attributes

options[R]

@return [ Hash ] options The options.

@since 2.11.0

Public Class Methods

new(options = {}) click to toggle source

Create the new log subscriber.

@param [ Hash ] options The options.

@option options [ Logger ] :logger An optional custom logger.

@since 2.11.0

# File lib/mongo/monitoring/unified_sdam_log_subscriber.rb, line 37
def initialize(options = {})
  @options = options
end

Public Instance Methods

published(event) click to toggle source

Handle an event.

@param [ Event ] event The event.

@since 2.11.0

# File lib/mongo/monitoring/unified_sdam_log_subscriber.rb, line 46
def published(event)
  log_debug("EVENT: #{event.summary}") if logger.debug?
end
Also aliased as: succeeded
subscribe(client) click to toggle source
# File lib/mongo/monitoring/unified_sdam_log_subscriber.rb, line 52
def subscribe(client)
  client.subscribe(Mongo::Monitoring::TOPOLOGY_OPENING, self)
  client.subscribe(Mongo::Monitoring::SERVER_OPENING, self)
  client.subscribe(Mongo::Monitoring::SERVER_DESCRIPTION_CHANGED, self)
  client.subscribe(Mongo::Monitoring::TOPOLOGY_CHANGED, self)
  client.subscribe(Mongo::Monitoring::SERVER_CLOSED, self)
  client.subscribe(Mongo::Monitoring::TOPOLOGY_CLOSED, self)
end
succeeded(event)
Alias for: published