diff options
author | 2023-09-24 16:32:09 -0700 | |
---|---|---|
committer | 2023-09-24 22:37:33 -0700 | |
commit | c0e954f19d707fef8ef8271636ec661634a4c4c7 (patch) | |
tree | 5aa052a048f470e233a454e5ad9071eed1fa37c0 /internal/ui/integration_pocket.go | |
parent | 54cb8fa0286e4a2f1a81c32b5a89722d93b30bf7 (diff) | |
download | v2-c0e954f19d707fef8ef8271636ec661634a4c4c7.tar.gz v2-c0e954f19d707fef8ef8271636ec661634a4c4c7.tar.zst v2-c0e954f19d707fef8ef8271636ec661634a4c4c7.zip |
Implement structured logging using log/slog package
Diffstat (limited to 'internal/ui/integration_pocket.go')
-rw-r--r-- | internal/ui/integration_pocket.go | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/internal/ui/integration_pocket.go b/internal/ui/integration_pocket.go index 752394f5..7da6b072 100644 --- a/internal/ui/integration_pocket.go +++ b/internal/ui/integration_pocket.go @@ -4,6 +4,7 @@ package ui // import "miniflux.app/v2/internal/ui" import ( + "log/slog" "net/http" "miniflux.app/v2/internal/config" @@ -12,7 +13,6 @@ import ( "miniflux.app/v2/internal/http/route" "miniflux.app/v2/internal/integration/pocket" "miniflux.app/v2/internal/locale" - "miniflux.app/v2/internal/logger" "miniflux.app/v2/internal/ui/session" ) @@ -35,7 +35,10 @@ func (h *handler) pocketAuthorize(w http.ResponseWriter, r *http.Request) { redirectURL := config.Opts.RootURL() + route.Path(h.router, "pocketCallback") requestToken, err := connector.RequestToken(redirectURL) if err != nil { - logger.Error("[Pocket:Authorize] %v", err) + slog.Warn("Pocket authorization request failed", + slog.Any("user_id", user.ID), + slog.Any("error", err), + ) sess.NewFlashErrorMessage(printer.Printf("error.pocket_request_token")) html.Redirect(w, r, route.Path(h.router, "integrations")) return @@ -64,7 +67,10 @@ func (h *handler) pocketCallback(w http.ResponseWriter, r *http.Request) { connector := pocket.NewConnector(config.Opts.PocketConsumerKey(integration.PocketConsumerKey)) accessToken, err := connector.AccessToken(request.PocketRequestToken(r)) if err != nil { - logger.Error("[Pocket:Callback] %v", err) + slog.Warn("Unable to get Pocket access token", + slog.Any("user_id", user.ID), + slog.Any("error", err), + ) sess.NewFlashErrorMessage(printer.Printf("error.pocket_access_token")) html.Redirect(w, r, route.Path(h.router, "integrations")) return |