Class: Nostr::Client::PlainLogger
- Defined in:
- lib/nostr/client/plain_logger.rb
Overview
Logs connection events, messages sent and received, errors, and connection closures.
Instance Method Summary collapse
-
#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.
Methods inherited from Logger
Instance Method Details
#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
64 65 66 |
# File 'lib/nostr/client/plain_logger.rb', line 64 def on_close(code, reason) puts "Connection closed: #{reason} (##{code})" 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
15 16 17 |
# File 'lib/nostr/client/plain_logger.rb', line 15 def on_connect(relay) puts "Connected to the relay #{relay.name} (#{relay.url})" 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
51 52 53 |
# File 'lib/nostr/client/plain_logger.rb', line 51 def on_error() puts "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
27 28 29 |
# File 'lib/nostr/client/plain_logger.rb', line 27 def () puts "◄- #{}" 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
39 40 41 |
# File 'lib/nostr/client/plain_logger.rb', line 39 def on_send() puts "-► #{}" end |