Skip to content

Commit

Permalink
Log non-JSON mercury upload responses on debug level
Browse files Browse the repository at this point in the history
  • Loading branch information
tulir committed May 23, 2024
1 parent 7222899 commit c06a4ea
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions messagix/mercury.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,10 @@ var antiJSPrefix = []byte("for (;;);")
func (c *Client) parseMercuryResponse(ctx context.Context, respBody []byte) (*types.MercuryUploadResponse, error) {
jsonData := bytes.TrimPrefix(respBody, antiJSPrefix)

logEvt := zerolog.Ctx(ctx).Trace()
if json.Valid(jsonData) {
logEvt.RawJSON("response_body", jsonData).Msg("Mercury upload response")
zerolog.Ctx(ctx).Trace().RawJSON("response_body", jsonData).Msg("Mercury upload response")
} else {
logEvt.Bytes("response_body", respBody).Msg("Mercury upload response (invalid JSON)")
zerolog.Ctx(ctx).Debug().Bytes("response_body", respBody).Msg("Mercury upload response (invalid JSON)")
}

var mercuryResponse *types.MercuryUploadResponse
Expand Down

0 comments on commit c06a4ea

Please sign in to comment.