Skip to content

Commit

Permalink
chore: add subscription uuid to logs
Browse files Browse the repository at this point in the history
  • Loading branch information
im-adithya committed Dec 19, 2024
1 parent df66787 commit de2d5c5
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions internal/nostr/nostr.go
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,7 @@ func (svc *Service) NIP47Handler(c echo.Context) error {
select {
case <-ctx.Done():
svc.Logger.WithError(ctx.Err()).WithFields(logrus.Fields{
"subscription_id": subscription.Uuid,
"request_event_id": requestData.SignedEvent.ID,
"client_pubkey": requestData.SignedEvent.PubKey,
"wallet_pubkey": requestData.WalletPubkey,
Expand Down Expand Up @@ -473,6 +474,7 @@ func (svc *Service) NIP47WebhookHandler(c echo.Context) error {
select {
case <-ctx.Done():
svc.Logger.WithError(ctx.Err()).WithFields(logrus.Fields{
"subscription_id": subscription.Uuid,
"request_event_id": requestData.SignedEvent.ID,
"client_pubkey": requestData.SignedEvent.PubKey,
"wallet_pubkey": requestData.WalletPubkey,
Expand Down Expand Up @@ -798,6 +800,7 @@ func (svc *Service) publishRequestEvent(ctx context.Context, subscription *Subsc
if err != nil {
// TODO: notify user about publish failure
svc.Logger.WithError(err).WithFields(logrus.Fields{
"subscription_id": subscription.Uuid,
"request_event_id": subscription.RequestEvent.NostrId,
"relay_url": subscription.RelayUrl,
"wallet_pubkey": walletPubkey,
Expand All @@ -807,6 +810,7 @@ func (svc *Service) publishRequestEvent(ctx context.Context, subscription *Subsc
sub.Unsub()
} else {
svc.Logger.WithFields(logrus.Fields{
"subscription_id": subscription.Uuid,
"request_event_id": subscription.RequestEvent.NostrId,
"relay_url": subscription.RelayUrl,
"wallet_pubkey": walletPubkey,
Expand Down Expand Up @@ -930,6 +934,7 @@ func (svc *Service) postEventToWebhook(event *nostr.Event, subscription *Subscri

if err != nil {
svc.Logger.WithError(err).WithFields(logrus.Fields{
"subscription_id": subscription.Uuid,
"request_event_id": request_event_id,
"response_event_id": event.ID,
"response_event_kind": event.Kind,
Expand All @@ -942,6 +947,7 @@ func (svc *Service) postEventToWebhook(event *nostr.Event, subscription *Subscri
_, err = http.Post(subscription.WebhookUrl, "application/json", bytes.NewBuffer(eventData))
if err != nil {
svc.Logger.WithError(err).WithFields(logrus.Fields{
"subscription_id": subscription.Uuid,
"request_event_id": request_event_id,
"response_event_id": event.ID,
"response_event_kind": event.Kind,
Expand All @@ -951,6 +957,7 @@ func (svc *Service) postEventToWebhook(event *nostr.Event, subscription *Subscri
}

svc.Logger.WithFields(logrus.Fields{
"subscription_id": subscription.Uuid,
"request_event_id": request_event_id,
"response_event_id": event.ID,
"response_event_kind": event.Kind,
Expand Down

0 comments on commit de2d5c5

Please sign in to comment.