Skip to content
Open
Show file tree
Hide file tree
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
3 changes: 2 additions & 1 deletion cmd/devp2p/runtest.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package main

import (
"log/slog"
"os"

"github.com/ethereum/go-ethereum/cmd/devp2p/internal/v4test"
Expand Down Expand Up @@ -86,7 +87,7 @@ func runTests(ctx *cli.Context, tests []utesting.Test) error {
}
// Disable logging unless explicitly enabled.
if !ctx.IsSet("verbosity") && !ctx.IsSet("vmodule") {
log.SetDefault(log.NewLogger(log.DiscardHandler()))
log.SetDefault(log.NewLogger(slog.DiscardHandler))
}
// Run the tests.
var run = utesting.RunTests
Expand Down
3 changes: 2 additions & 1 deletion cmd/workload/testsuite.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"embed"
"errors"
"io/fs"
"log/slog"
"os"

"github.com/ethereum/go-ethereum/core/history"
Expand Down Expand Up @@ -240,7 +241,7 @@ func runTestCmd(ctx *cli.Context) error {

// Disable logging unless explicitly enabled.
if !ctx.IsSet("verbosity") && !ctx.IsSet("vmodule") {
log.SetDefault(log.NewLogger(log.DiscardHandler()))
log.SetDefault(log.NewLogger(slog.DiscardHandler))
}

// Run the tests.
Expand Down
23 changes: 0 additions & 23 deletions log/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,29 +13,6 @@ import (
"github.com/holiman/uint256"
)

type discardHandler struct{}

// DiscardHandler returns a no-op handler
func DiscardHandler() slog.Handler {
return &discardHandler{}
}

func (h *discardHandler) Handle(_ context.Context, r slog.Record) error {
return nil
}

func (h *discardHandler) Enabled(_ context.Context, level slog.Level) bool {
return false
}

func (h *discardHandler) WithGroup(name string) slog.Handler {
panic("not implemented")
}

func (h *discardHandler) WithAttrs(attrs []slog.Attr) slog.Handler {
return &discardHandler{}
}

type TerminalHandler struct {
mu sync.Mutex
wr io.Writer
Expand Down
2 changes: 1 addition & 1 deletion log/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ var (
)

func init() {
root = &logger{slog.New(DiscardHandler())}
root = &logger{slog.New(slog.DiscardHandler)}
}

// SetDefault sets the default global logger
Expand Down