Class: Mongo::Monitoring::UnifiedSdamLogSubscriber
- Inherits:
-
Object
- Object
- Mongo::Monitoring::UnifiedSdamLogSubscriber
- Includes:
- Loggable
- Defined in:
- build/ruby-driver-v2.19/lib/mongo/monitoring/unified_sdam_log_subscriber.rb
Overview
Subscribes to SDAM events and logs them.
Constant Summary
Constants included from Loggable
Instance Attribute Summary collapse
-
#options ⇒ Hash
readonly
Options The options.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ UnifiedSdamLogSubscriber
constructor
Create the new log subscriber.
-
#published(event) ⇒ Object
(also: #succeeded)
Handle an event.
- #subscribe(client) ⇒ Object
Methods included from Loggable
#log_debug, #log_error, #log_fatal, #log_info, #log_warn, #logger
Constructor Details
#initialize(options = {}) ⇒ UnifiedSdamLogSubscriber
Create the new log subscriber.
40 41 42 |
# File 'build/ruby-driver-v2.19/lib/mongo/monitoring/unified_sdam_log_subscriber.rb', line 40 def initialize( = {}) @options = end |
Instance Attribute Details
#options ⇒ Hash (readonly)
Returns options The options.
31 32 33 |
# File 'build/ruby-driver-v2.19/lib/mongo/monitoring/unified_sdam_log_subscriber.rb', line 31 def @options end |
Instance Method Details
#published(event) ⇒ Object Also known as: succeeded
Handle an event.
49 50 51 |
# File 'build/ruby-driver-v2.19/lib/mongo/monitoring/unified_sdam_log_subscriber.rb', line 49 def published(event) log_debug("EVENT: #{event.summary}") if logger.debug? end |
#subscribe(client) ⇒ Object
55 56 57 58 59 60 61 62 |
# File 'build/ruby-driver-v2.19/lib/mongo/monitoring/unified_sdam_log_subscriber.rb', line 55 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 |