From f75f6b7f9a984637964516199efbd6d9a77044fa Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Mon, 25 Nov 2024 19:39:04 +0200 Subject: [PATCH] twittermeow/http: log polling on trace level --- pkg/twittermeow/http.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/pkg/twittermeow/http.go b/pkg/twittermeow/http.go index 86214a6..c22ad00 100644 --- a/pkg/twittermeow/http.go +++ b/pkg/twittermeow/http.go @@ -6,8 +6,12 @@ import ( "fmt" "io" "net/http" + "strings" "time" + "github.com/rs/zerolog" + + "go.mau.fi/mautrix-twitter/pkg/twittermeow/data/endpoints" "go.mau.fi/mautrix-twitter/pkg/twittermeow/types" ) @@ -39,7 +43,13 @@ func (c *Client) MakeRequest(url string, method string, headers http.Header, pay resp, respDat, err := c.makeRequestDirect(url, method, headers, payload, contentType) dur := time.Since(start) if err == nil { - c.Logger.Debug(). + var logEvt *zerolog.Event + if strings.HasPrefix(url, endpoints.DM_USER_UPDATES_URL) { + logEvt = c.Logger.Trace() + } else { + logEvt = c.Logger.Debug() + } + logEvt. Str("url", url). Str("method", method). Dur("duration", dur).