Skip to content

Commit

Permalink
twittermeow/http: log polling on trace level
Browse files Browse the repository at this point in the history
  • Loading branch information
tulir committed Nov 25, 2024
1 parent 4037aa8 commit f75f6b7
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion pkg/twittermeow/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand Down Expand Up @@ -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).
Expand Down

0 comments on commit f75f6b7

Please sign in to comment.