Skip to content

Commit

Permalink
chore: json logging
Browse files Browse the repository at this point in the history
  • Loading branch information
im-adithya committed Feb 15, 2024
1 parent 58047ab commit 952a6c0
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions internal/nostr/nostr.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,9 @@ func (svc *NostrService) NIP47Handler(c echo.Context) error {

func (svc *NostrService) getRelayConnection(ctx context.Context, customRelayURL string) (*nostr.Relay, bool, error) {
if customRelayURL != "" && customRelayURL != svc.config.DefaultRelayURL {
logrus.Infof("connecting to custom relay: %s...", customRelayURL)
logrus.WithFields(logrus.Fields{
"customRelayURL": customRelayURL,
}).Infof("connecting to custom relay")
relay, err := nostr.RelayConnect(ctx, customRelayURL)
return relay, true, err // true means custom and the relay should be closed
}
Expand Down Expand Up @@ -176,7 +178,10 @@ func (svc *NostrService) processRequest(ctx context.Context, requestData *NIP47R
case <-ctx.Done():
return &nostr.Event{}, http.StatusRequestTimeout, fmt.Errorf("request canceled or timed out")
case event := <-sub.Events:
logrus.Infof("successfully received event: %s", event.ID)
logrus.WithFields(logrus.Fields{
"eventId": event.ID,
"eventKind": event.Kind,
}).Infof("successfully received event")
return event, http.StatusOK, nil
}
}
Expand Down

0 comments on commit 952a6c0

Please sign in to comment.