123456789_123456789_123456789_123456789_123456789_

Class: Mongo::Monitoring::ServerDescriptionChangedLogSubscriber

Relationships & Source Files
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
Instance Chain:
Inherits: Mongo::Monitoring::SDAMLogSubscriber
Defined in: lib/mongo/monitoring/server_description_changed_log_subscriber.rb

Overview

Subscribes to ::Mongo::Server Description Changed events and logs them.

Since:

  • 2.4.0

Constant Summary

::Mongo::Loggable - Included

PREFIX

Class Method Summary

SDAMLogSubscriber - Inherited

.new

Create the new log subscriber.

Instance Attribute Summary

Instance Method Summary

SDAMLogSubscriber - Inherited

#succeeded

Handle the SDAM succeeded event.

::Mongo::Loggable - Included

#log_debug

Convenience method to log debug messages with the standard prefix.

#log_error

Convenience method to log error messages with the standard prefix.

#log_fatal

Convenience method to log fatal messages with the standard prefix.

#log_info

Convenience method to log info messages with the standard prefix.

#log_warn

Convenience method to log warn messages with the standard prefix.

#logger

Get the logger instance.

#_mongo_log_prefix, #format_message

Constructor Details

This class inherits a constructor from Mongo::Monitoring::SDAMLogSubscriber

Instance Method Details

#awaited_indicator(event) (private)

Since:

  • 2.4.0

[ GitHub ]

  
# File 'lib/mongo/monitoring/server_description_changed_log_subscriber.rb', line 35

def awaited_indicator(event)
  if event.awaited?
    ' [awaited]'
  else
    ''
  end
end

#log_event(event) (private)

Since:

  • 2.4.0

[ GitHub ]

  
# File 'lib/mongo/monitoring/server_description_changed_log_subscriber.rb', line 28

def log_event(event)
  log_debug(
    "Server description for #{event.address} changed from " +
    "'#{event.previous_description.server_type}' to '#{event.new_description.server_type}'#{awaited_indicator(event)}."
  )
end