Skip to content

Commit

Permalink
Use debug level for some logs
Browse files Browse the repository at this point in the history
Thse produce a lot of log lines and we don't actively use those it seems
  • Loading branch information
bumi committed Jul 27, 2024
1 parent 12c76a5 commit 3d99c56
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions internal/nostr/nostr.go
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ func (svc *Service) PublishHandler(c echo.Context) error {
"event_id": requestData.SignedEvent.ID,
"relay_url": requestData.RelayUrl,
}).Error("Failed to publish event")

return c.JSON(http.StatusInternalServerError, ErrorResponse{
Message: "Error publishing the event",
Error: err.Error(),
Expand Down Expand Up @@ -627,13 +627,13 @@ func (svc *Service) StopSubscriptionHandler(c echo.Context) error {

svc.Logger.WithFields(logrus.Fields{
"subscription_id": subscription.ID,
}).Info("Stopping subscription")
}).Debug("Stopping subscription")

err := svc.stopSubscription(&subscription)
if err != nil {
svc.Logger.WithFields(logrus.Fields{
"subscription_id": subscription.ID,
}).Info("Subscription is stopped already")
}).Debug("Subscription is stopped already")

return c.JSON(http.StatusAlreadyReported, StopSubscriptionResponse{
Message: "Subscription is already closed",
Expand Down Expand Up @@ -675,7 +675,7 @@ func (svc *Service) startSubscription(ctx context.Context, subscription *Subscri
svc.Logger.WithFields(logrus.Fields{
"subscription_id": subscription.ID,
"wallet_pubkey": svc.getWalletPubkey(subscription.Authors),
}).Info("Starting subscription")
}).Debug("Starting subscription")

filter := svc.subscriptionToFilter(subscription)

Expand Down Expand Up @@ -721,7 +721,7 @@ func (svc *Service) startSubscription(ctx context.Context, subscription *Subscri
svc.Logger.WithFields(logrus.Fields{
"subscription_id": subscription.ID,
"wallet_pubkey": svc.getWalletPubkey(subscription.Authors),
}).Info("Started subscription")
}).Debug("Started subscription")

err = svc.processEvents(ctx, subscription, onReceiveEOS, handleEvent)

Expand Down Expand Up @@ -752,7 +752,7 @@ func (svc *Service) startSubscription(ctx context.Context, subscription *Subscri
"subscription_id": subscription.ID,
"relay_url": subscription.RelayUrl,
"wallet_pubkey": svc.getWalletPubkey(subscription.Authors),
}).Info("Stopping subscription")
}).Debug("Stopping subscription")
break
}
}
Expand Down Expand Up @@ -833,8 +833,8 @@ func (svc *Service) processEvents(ctx context.Context, subscription *Subscriptio
svc.Logger.WithFields(logrus.Fields{
"subscription_id": subscription.ID,
"wallet_pubkey": svc.getWalletPubkey(subscription.Authors),
}).Info("Received EOS")
}).Debug("Received EOS")

if (onReceiveEOS != nil) {
onReceiveEOS(ctx, subscription)
}
Expand All @@ -847,7 +847,7 @@ func (svc *Service) processEvents(ctx context.Context, subscription *Subscriptio
svc.Logger.WithFields(logrus.Fields{
"subscription_id": subscription.ID,
"wallet_pubkey": svc.getWalletPubkey(subscription.Authors),
}).Info("Relay subscription events channel ended")
}).Debug("Relay subscription events channel ended")
}()

select {
Expand All @@ -868,7 +868,6 @@ func (svc *Service) getRelayConnection(ctx context.Context, customRelayURL strin
relay, err := nostr.RelayConnect(ctx, customRelayURL)
return relay, true, err // true means custom and the relay should be closed
}
svc.Logger.Info("Fetching default relay")
// use mutex otherwise the svc.Relay will be reconnected more than once
svc.relayMutex.Lock()
defer svc.relayMutex.Unlock()
Expand Down

0 comments on commit 3d99c56

Please sign in to comment.