Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion log/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func (h *discardHandler) WithAttrs(attrs []slog.Attr) slog.Handler {
}

type TerminalHandler struct {
mu sync.Mutex
mu *sync.Mutex
wr io.Writer
lvl slog.Level
useColor bool
Expand Down Expand Up @@ -66,6 +66,7 @@ func NewTerminalHandler(wr io.Writer, useColor bool) *TerminalHandler {
// records which are less than or equal to the specified verbosity level.
func NewTerminalHandlerWithLevel(wr io.Writer, lvl slog.Level, useColor bool) *TerminalHandler {
return &TerminalHandler{
mu: &sync.Mutex{},
wr: wr,
lvl: lvl,
useColor: useColor,
Expand All @@ -92,6 +93,7 @@ func (h *TerminalHandler) WithGroup(name string) slog.Handler {

func (h *TerminalHandler) WithAttrs(attrs []slog.Attr) slog.Handler {
return &TerminalHandler{
mu: h.mu,
wr: h.wr,
lvl: h.lvl,
useColor: h.useColor,
Expand Down
Loading