Skip to content

Commit

Permalink
cmd/bsky-webhook: don't log opaque bytes on error (#8)
Browse files Browse the repository at this point in the history
An error in a Jetstream message currently logs the raw message as bytes, which
the slog output renders as [01 02 03 ...] format. This is noisy, and also hard
to debug, so let's truncate them and quote them for the logger.
  • Loading branch information
creachadair authored Nov 18, 2024
1 parent fa25fe5 commit f1965fb
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion cmd/bsky-webhook/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,8 @@ func websocketConnection(ctx context.Context, wsUrl url.URL) error {

err = readJetstreamMessage(ctx, jetstreamMessage, bsky)
if err != nil {
log.Println("error reading jetstream message: ", jetstreamMessage, err)
msg := jetstreamMessage[:min(32, len(jetstreamMessage))]
log.Printf("error reading jetstream message %q: %v", msg, err)
continue
}
}
Expand Down

0 comments on commit f1965fb

Please sign in to comment.