Class: Nostr::Client::Logger
- Inherits:
-
Object
- Object
- Nostr::Client::Logger
- Defined in:
- lib/nostr/client/logger.rb
Overview
Logs connection events, messages sent and received, errors, and connection closures.
Direct Known Subclasses
Instance Method Summary collapse
-
#attach_to(client) ⇒ void
Attaches event handlers to the specified Nostr client for logging purposes.
-
#on_close(code, reason) ⇒ void
private
Logs a closure of connection with a relay.
-
#on_connect(relay) ⇒ void
private
Logs connection to a relay.
-
#on_error(message) ⇒ void
private
Logs an error message.
-
#on_message(message) ⇒ void
private
Logs a message received from the relay.
-
#on_send(message) ⇒ void
private
Logs a message sent to the relay.
Instance Method Details
#attach_to(client) ⇒ void
This method returns an undefined value.
Attaches event handlers to the specified Nostr client for logging purposes
23 24 25 26 27 28 29 30 31 |
# File 'lib/nostr/client/logger.rb', line 23 def attach_to(client) logger_instance = self client.on(:connect) { |relay| logger_instance.on_connect(relay) } client.on(:message) { || logger_instance.() } client.on(:send) { || logger_instance.on_send() } client.on(:error) { || logger_instance.on_error() } client.on(:close) { |code, reason| logger_instance.on_close(code, reason) } end |
#on_close(code, reason) ⇒ void
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method returns an undefined value.
Logs a closure of connection with a relay
82 |
# File 'lib/nostr/client/logger.rb', line 82 def on_close(code, reason); end |
#on_connect(relay) ⇒ void
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method returns an undefined value.
Logs connection to a relay
41 |
# File 'lib/nostr/client/logger.rb', line 41 def on_connect(relay); end |
#on_error(message) ⇒ void
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method returns an undefined value.
Logs an error message
71 |
# File 'lib/nostr/client/logger.rb', line 71 def on_error(); end |
#on_message(message) ⇒ void
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method returns an undefined value.
Logs a message received from the relay
51 |
# File 'lib/nostr/client/logger.rb', line 51 def (); end |
#on_send(message) ⇒ void
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method returns an undefined value.
Logs a message sent to the relay
61 |
# File 'lib/nostr/client/logger.rb', line 61 def on_send(); end |