mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
add missing parts from previous commit
This commit is contained in:
parent
14bc27f178
commit
5beed9f75d
3 changed files with 3 additions and 5 deletions
|
|
@ -73,7 +73,7 @@ type TerminalStringer interface {
|
|||
// Example:
|
||||
//
|
||||
// [DBUG] [May 16 20:58:45] remove route ns=haproxy addr=127.0.0.1:50002
|
||||
func TerminalFormat(r slog.Record, usecolor bool) []byte {
|
||||
func TerminalFormat(r slog.Record, commonAttrs []slog.Attr, usecolor bool) []byte {
|
||||
msg := escapeMessage(r.Message)
|
||||
var color = 0
|
||||
if usecolor {
|
||||
|
|
@ -106,7 +106,7 @@ func TerminalFormat(r slog.Record, usecolor bool) []byte {
|
|||
b.Write(bytes.Repeat([]byte{' '}, termMsgJust-length))
|
||||
}
|
||||
// print the keys logfmt style
|
||||
logfmt(b, []slog.Attr{}, r, color, true)
|
||||
logfmt(b, commonAttrs, r, color, true)
|
||||
return b.Bytes()
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -140,8 +140,7 @@ func TerminalHandlerWithLevel(wr io.Writer, lvl slog.Level, useColor bool) slog.
|
|||
func (h *terminalHandler) Handle(_ context.Context, r slog.Record) error {
|
||||
h.mu.Lock()
|
||||
defer h.mu.Unlock()
|
||||
r.AddAttrs(h.attrs...)
|
||||
h.wr.Write(TerminalFormat(r, h.useColor))
|
||||
h.wr.Write(TerminalFormat(r, h.attrs, h.useColor))
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ import (
|
|||
"os"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"golang.org/x/exp/slog"
|
||||
)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue