mirror of
https://github.com/nbd-wtf/go-nostr.git
synced 2025-07-05 04:54:31 +02:00
rename debugLog->debugLogf
This commit is contained in:
@ -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))
|
||||
|
||||
|
@ -2,6 +2,6 @@
|
||||
|
||||
package nostr
|
||||
|
||||
func debugLog(str string, args ...any) {
|
||||
func debugLogf(str string, args ...any) {
|
||||
return
|
||||
}
|
||||
|
3
pool.go
3
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
|
||||
}
|
||||
|
||||
|
6
relay.go
6
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
|
||||
|
@ -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 {
|
||||
|
Reference in New Issue
Block a user