diff --git a/log_debug.go b/log_debug.go index 084eb19..3fb34c8 100644 --- a/log_debug.go +++ b/log_debug.go @@ -7,7 +7,7 @@ import ( "fmt" ) -func debugLog(str string, args ...any) { +func debugLogf(str string, args ...any) { // this is such that we don't modify the actual args that may be used outside of this function printableArgs := make([]any, len(args)) diff --git a/log_normal.go b/log_normal.go index cd6a746..0e3c4af 100644 --- a/log_normal.go +++ b/log_normal.go @@ -2,6 +2,6 @@ package nostr -func debugLog(str string, args ...any) { +func debugLogf(str string, args ...any) { return } diff --git a/pool.go b/pool.go index 156c257..4871371 100644 --- a/pool.go +++ b/pool.go @@ -115,8 +115,9 @@ func (pool *SimplePool) SubManyEose(ctx context.Context, urls []string, filters return } - sub, _ := relay.Subscribe(ctx, filters) + sub, err := relay.Subscribe(ctx, filters) if sub == nil { + debugLogf("error subscribing to %s with %v: %s", relay, filters, err) return } diff --git a/relay.go b/relay.go index ba457a8..ac7941f 100644 --- a/relay.go +++ b/relay.go @@ -240,7 +240,7 @@ func (r *Relay) Connect(ctx context.Context) error { break } - debugLog("{%s} %v\n", r.URL, message) + debugLogf("{%s} %v\n", r.URL, message) envelope := ParseMessage(message) if envelope == nil { @@ -370,7 +370,7 @@ func (r *Relay) Publish(ctx context.Context, event Event) (Status, error) { // publish event envb, _ := EventEnvelope{Event: event}.MarshalJSON() - debugLog("{%s} sending %v\n", r.URL, envb) + debugLogf("{%s} sending %v\n", r.URL, envb) status = PublishStatusSent if err := <-r.Write(envb); err != nil { status = PublishStatusFailed @@ -434,7 +434,7 @@ func (r *Relay) Auth(ctx context.Context, event Event) (Status, error) { // send AUTH authResponse, _ := AuthEnvelope{Event: event}.MarshalJSON() - debugLog("{%s} sending %v\n", r.URL, authResponse) + debugLogf("{%s} sending %v\n", r.URL, authResponse) if err := <-r.Write(authResponse); err != nil { // status will be "failed" return status, err diff --git a/subscription.go b/subscription.go index f1826b3..49a8008 100644 --- a/subscription.go +++ b/subscription.go @@ -107,7 +107,7 @@ func (sub *Subscription) Close() { id := sub.GetID() closeMsg := CloseEnvelope(id) closeb, _ := (&closeMsg).MarshalJSON() - debugLog("{%s} sending %v", sub.Relay.URL, closeb) + debugLogf("{%s} sending %v", sub.Relay.URL, closeb) <-sub.Relay.Write(closeb) } } @@ -124,7 +124,7 @@ func (sub *Subscription) Fire() error { id := sub.GetID() reqb, _ := ReqEnvelope{id, sub.Filters}.MarshalJSON() - debugLog("{%s} sending %v", sub.Relay.URL, reqb) + debugLogf("{%s} sending %v", sub.Relay.URL, reqb) sub.live.Store(true) if err := <-sub.Relay.Write(reqb); err != nil {