Add plain text and coloured logging to the Client
Logs websocket events (connect, message, error and close events)
This commit is contained in:
@@ -10,6 +10,7 @@ module Nostr
|
||||
|
||||
private
|
||||
|
||||
attr_reader logger: Logger
|
||||
attr_reader subscriptions: Hash[String, Subscription]
|
||||
attr_reader parent_to_child_channel: EventMachine::Channel
|
||||
attr_reader child_to_parent_channel: EventMachine::Channel
|
||||
|
||||
6
sig/nostr/client/color_logger.rbs
Normal file
6
sig/nostr/client/color_logger.rbs
Normal file
@@ -0,0 +1,6 @@
|
||||
module Nostr
|
||||
class Client
|
||||
class ColorLogger < Logger
|
||||
end
|
||||
end
|
||||
end
|
||||
12
sig/nostr/client/logger.rbs
Normal file
12
sig/nostr/client/logger.rbs
Normal file
@@ -0,0 +1,12 @@
|
||||
module Nostr
|
||||
class Client
|
||||
class Logger
|
||||
def attach_to: (Client client) -> void
|
||||
def on_connect: (Relay relay) -> void
|
||||
def on_message: (String message) -> void
|
||||
def on_send: (String message) -> void
|
||||
def on_error: (String message) -> void
|
||||
def on_close: (String code, String reason) -> void
|
||||
end
|
||||
end
|
||||
end
|
||||
6
sig/nostr/client/plain_logger.rbs
Normal file
6
sig/nostr/client/plain_logger.rbs
Normal file
@@ -0,0 +1,6 @@
|
||||
module Nostr
|
||||
class Client
|
||||
class PlainLogger < Logger
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user