fix example test case

This commit is contained in:
Jared Wasinger 2025-04-01 23:17:13 +02:00
parent dc5cd6e350
commit 8f1a56bb4e

View file

@ -1,8 +1,9 @@
package testlog package testlog
import ( import (
"github.com/ethereum/go-ethereum/log"
"testing" "testing"
"github.com/ethereum/go-ethereum/log"
) )
func TestLogging(t *testing.T) { func TestLogging(t *testing.T) {
@ -10,12 +11,6 @@ func TestLogging(t *testing.T) {
subLogger := l.New("foobar", 123) subLogger := l.New("foobar", 123)
l.Info("Visible") l.Info("Visible")
subLogger.Info("Hide and seek") // not visible due to sub buffer never being flushed subLogger.Info("Hide and seek") // this log is erroneously hidden in master, but fixed with this PR
l.Info("Also visible") l.Info("Also visible")
t.Log("flushed: ", l.Handler().(*bufHandler).buf)
t.Log("remaining: ", subLogger.Handler().(*bufHandler).buf)
// horrible hack to manually bring back the expected log data
l.Handler().(*bufHandler).buf = subLogger.Handler().(*bufHandler).buf
l.(*logger).flush()
} }