Skip to content

Commit

Permalink
remove fmt.Sprintf
Browse files Browse the repository at this point in the history
remove fmt.Sprintf as r.Message is already a string
  • Loading branch information
MatusOllah committed May 24, 2024
1 parent e027c7b commit c38983a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ func (h *Handler) Handle(_ context.Context, r slog.Record) error {
})

fmt.Fprint(&bf, h.opts.MsgPrefix)
formattedMessage := fmt.Sprintf("%s", r.Message)
formattedMessage := r.Message
if h.opts.MsgLength > 0 && len(attrs) > 0 {
if len(formattedMessage) > h.opts.MsgLength {
formattedMessage = formattedMessage[:h.opts.MsgLength-1] + "…" // Truncate and add ellipsis if too long
Expand Down

0 comments on commit c38983a

Please sign in to comment.