From ef96d6ce7734616f0f066cd0e0e9fa535fbe780c Mon Sep 17 00:00:00 2001 From: Will Date: Tue, 5 Mar 2024 21:15:26 +1100 Subject: [PATCH] add debug logs --- services/notifications/default.go | 5 +++++ services/url/default.go | 2 -- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/services/notifications/default.go b/services/notifications/default.go index ba3aaae..8fe11d1 100644 --- a/services/notifications/default.go +++ b/services/notifications/default.go @@ -146,11 +146,14 @@ func (n notificationsService) Notify() (err error) { } func (n notificationsService) notifySubscriber(sub Subscription) error { + n.Log.Debug("notify subscriber") pub, err := n.GetPubKey() priv, err := n.GetPrivKey() if err != nil { return err } + n.Log.Debug("got keys") + n.Log.Debug("sending using webpush") resp, err := webpush.SendNotification([]byte("Notification received"), &sub, &webpush.Options{ VAPIDPublicKey: *pub, VAPIDPrivateKey: *priv, @@ -160,7 +163,9 @@ func (n notificationsService) notifySubscriber(sub Subscription) error { if err != nil { return err } + n.Log.Debug("sent") if resp.StatusCode == 410 { + n.Log.Debug("deleting") n.db.DeleteObject(sub) } return nil diff --git a/services/url/default.go b/services/url/default.go index 0e072c4..e3f8039 100644 --- a/services/url/default.go +++ b/services/url/default.go @@ -3,7 +3,6 @@ package url import ( "context" "errors" - "fmt" "log/slog" "net/url" ) @@ -14,7 +13,6 @@ func GetURL(ctx context.Context) (*url.URL, error) { if req, ok := ctx.Value("url").(*url.URL); ok { req.Host = hostname req.Scheme = "https" - fmt.Println(req.String()) return req, nil } return nil, errors.New("couldn't get url")