lib/wamp/client/session.rb in wamp_client-0.1.1 vs lib/wamp/client/session.rb in wamp_client-0.1.2
- old
+ new
@@ -179,11 +179,11 @@
else
raise RuntimeError, "Unknown on(event) '#{event}'"
end
end
- attr_accessor :id, :realm, :transport, :verbose, :options
+ attr_accessor :id, :realm, :transport, :options
# Private attributes
attr_accessor :_goodbye_sent, :_requests, :_subscriptions, :_registrations, :_defers
# Constructor
@@ -195,11 +195,10 @@
# Parameters
self.id = nil
self.realm = nil
self.options = options || {}
- self.verbose = self.options[:verbose]
# Outstanding Requests
self._requests = {
publish: {},
subscribe: {},
@@ -292,24 +291,22 @@
end
# Sends a message
# @param msg [Wamp::Client::Message::Base]
def _send_message(msg)
- puts 'TX: ' + msg.to_s if self.verbose
+ logger.debug("#{self.class.name} TX: #{msg.to_s}")
self.transport.send_message(msg.payload)
end
# Processes received messages
# @param msg [Array]
def _receive_message(msg)
message = Wamp::Client::Message::Base.parse(msg)
- if self.verbose
- puts 'RX: ' + message.to_s if message
- puts 'RX(non-wamp): ' + msg.to_s unless message
- end
+ logger.debug("#{self.class.name} RX: #{message.to_s}")
+ logger.debug("#{self.class.name} RX(non-samp): #{msg.to_s}")
# WAMP Session is not open
if self.id.nil?
# Parse the welcome message
@@ -993,9 +990,17 @@
cancel = Wamp::Client::Message::Cancel.new(call.id, { mode: mode })
self._send_message(cancel)
end
#endregion
+
+ private
+
+ # Returns the logger
+ #
+ def logger
+ Wamp::Client.logger
+ end
end
end
end
\ No newline at end of file