mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
simplify TerminalHandler constructor/WithAttrs by omitting explicit instantiation for value types that take defaults
This commit is contained in:
parent
cdde508ef1
commit
a86ccc4212
1 changed files with 9 additions and 12 deletions
|
|
@ -100,12 +100,10 @@ func NewTerminalHandler(wr io.Writer, useColor bool) *TerminalHandler {
|
||||||
// records which are less than or equal to the specified verbosity level.
|
// records which are less than or equal to the specified verbosity level.
|
||||||
func NewTerminalHandlerWithLevel(wr io.Writer, lvl slog.Level, useColor bool) *TerminalHandler {
|
func NewTerminalHandlerWithLevel(wr io.Writer, lvl slog.Level, useColor bool) *TerminalHandler {
|
||||||
return &TerminalHandler{
|
return &TerminalHandler{
|
||||||
sync.Mutex{},
|
wr: wr,
|
||||||
wr,
|
lvl: lvl,
|
||||||
lvl,
|
useColor: useColor,
|
||||||
useColor,
|
fieldPadding: make(map[string]int),
|
||||||
[]slog.Attr{},
|
|
||||||
make(map[string]int),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -126,12 +124,11 @@ func (h *TerminalHandler) WithGroup(name string) slog.Handler {
|
||||||
|
|
||||||
func (h *TerminalHandler) WithAttrs(attrs []slog.Attr) slog.Handler {
|
func (h *TerminalHandler) WithAttrs(attrs []slog.Attr) slog.Handler {
|
||||||
return &TerminalHandler{
|
return &TerminalHandler{
|
||||||
sync.Mutex{},
|
wr: h.wr,
|
||||||
h.wr,
|
lvl: h.lvl,
|
||||||
h.lvl,
|
useColor: h.useColor,
|
||||||
h.useColor,
|
attrs: append(h.attrs, attrs...),
|
||||||
append(h.attrs, attrs...),
|
fieldPadding: make(map[string]int),
|
||||||
make(map[string]int),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue