mirror of
https://github.com/nbd-wtf/go-nostr.git
synced 2025-07-04 20:44:28 +02:00
rename debugLog->debugLogf
This commit is contained in:
@ -7,7 +7,7 @@ import (
|
|||||||
"fmt"
|
"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
|
// this is such that we don't modify the actual args that may be used outside of this function
|
||||||
printableArgs := make([]any, len(args))
|
printableArgs := make([]any, len(args))
|
||||||
|
|
||||||
|
@ -2,6 +2,6 @@
|
|||||||
|
|
||||||
package nostr
|
package nostr
|
||||||
|
|
||||||
func debugLog(str string, args ...any) {
|
func debugLogf(str string, args ...any) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
3
pool.go
3
pool.go
@ -115,8 +115,9 @@ func (pool *SimplePool) SubManyEose(ctx context.Context, urls []string, filters
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
sub, _ := relay.Subscribe(ctx, filters)
|
sub, err := relay.Subscribe(ctx, filters)
|
||||||
if sub == nil {
|
if sub == nil {
|
||||||
|
debugLogf("error subscribing to %s with %v: %s", relay, filters, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
6
relay.go
6
relay.go
@ -240,7 +240,7 @@ func (r *Relay) Connect(ctx context.Context) error {
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
debugLog("{%s} %v\n", r.URL, message)
|
debugLogf("{%s} %v\n", r.URL, message)
|
||||||
|
|
||||||
envelope := ParseMessage(message)
|
envelope := ParseMessage(message)
|
||||||
if envelope == nil {
|
if envelope == nil {
|
||||||
@ -370,7 +370,7 @@ func (r *Relay) Publish(ctx context.Context, event Event) (Status, error) {
|
|||||||
|
|
||||||
// publish event
|
// publish event
|
||||||
envb, _ := EventEnvelope{Event: event}.MarshalJSON()
|
envb, _ := EventEnvelope{Event: event}.MarshalJSON()
|
||||||
debugLog("{%s} sending %v\n", r.URL, envb)
|
debugLogf("{%s} sending %v\n", r.URL, envb)
|
||||||
status = PublishStatusSent
|
status = PublishStatusSent
|
||||||
if err := <-r.Write(envb); err != nil {
|
if err := <-r.Write(envb); err != nil {
|
||||||
status = PublishStatusFailed
|
status = PublishStatusFailed
|
||||||
@ -434,7 +434,7 @@ func (r *Relay) Auth(ctx context.Context, event Event) (Status, error) {
|
|||||||
|
|
||||||
// send AUTH
|
// send AUTH
|
||||||
authResponse, _ := AuthEnvelope{Event: event}.MarshalJSON()
|
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 {
|
if err := <-r.Write(authResponse); err != nil {
|
||||||
// status will be "failed"
|
// status will be "failed"
|
||||||
return status, err
|
return status, err
|
||||||
|
@ -107,7 +107,7 @@ func (sub *Subscription) Close() {
|
|||||||
id := sub.GetID()
|
id := sub.GetID()
|
||||||
closeMsg := CloseEnvelope(id)
|
closeMsg := CloseEnvelope(id)
|
||||||
closeb, _ := (&closeMsg).MarshalJSON()
|
closeb, _ := (&closeMsg).MarshalJSON()
|
||||||
debugLog("{%s} sending %v", sub.Relay.URL, closeb)
|
debugLogf("{%s} sending %v", sub.Relay.URL, closeb)
|
||||||
<-sub.Relay.Write(closeb)
|
<-sub.Relay.Write(closeb)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -124,7 +124,7 @@ func (sub *Subscription) Fire() error {
|
|||||||
id := sub.GetID()
|
id := sub.GetID()
|
||||||
|
|
||||||
reqb, _ := ReqEnvelope{id, sub.Filters}.MarshalJSON()
|
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)
|
sub.live.Store(true)
|
||||||
if err := <-sub.Relay.Write(reqb); err != nil {
|
if err := <-sub.Relay.Write(reqb); err != nil {
|
||||||
|
Reference in New Issue
Block a user