Skip to content

Commit 87fb93d

Browse files
committed
update to latest slog branch
1 parent 3bab4dd commit 87fb93d

File tree

3 files changed

+40
-66
lines changed

3 files changed

+40
-66
lines changed

benchmarks_test.go

Lines changed: 34 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,39 +9,61 @@ import (
99
)
1010

1111
func BenchmarkJson(b *testing.B) {
12-
log.Root().SetHandler(log.WrapHandler(log.MinLvl, log.StreamHandler(io.Discard, log.JSONFormat())))
12+
log.SetDefault(log.NewLogger(log.JsonHandler(io.Discard)))
1313

1414
for i := 0; i < b.N; i++ {
1515
log.Info("a message", "foo", "bar", "baz", "bat")
1616
}
1717
}
1818

19-
func BenchmarkGloggerNotEnabled(b *testing.B) {
20-
glogHandler := log.NewGlogHandler(log.StreamHandler(io.Discard, log.TerminalFormat(false)))
21-
glogHandler.Verbosity(log.LvlError)
22-
log.Root().SetHandler(glogHandler)
19+
func BenchmarkGloggerDisabled(b *testing.B) {
20+
glogHandler := log.NewGlogHandler(log.TerminalHandler(io.Discard, false))
21+
glogHandler.Verbosity(log.LevelError)
22+
log.SetDefault(log.NewLogger(glogHandler))
2323

2424
for i := 0; i < b.N; i++ {
2525
log.Info("foo", "bar", "baz", "bat")
2626
}
2727

2828
}
2929

30-
func BenchmarkGloggerEnabledDiscardHandler(b *testing.B) {
30+
func BenchmarkGloggerDiscard(b *testing.B) {
3131
glogHandler := log.NewGlogHandler(log.DiscardHandler())
32-
glogHandler.Verbosity(log.LvlInfo)
33-
log.Root().SetHandler(glogHandler)
32+
glogHandler.Verbosity(log.LevelInfo)
33+
log.SetDefault(log.NewLogger(glogHandler))
3434

3535
for i := 0; i < b.N; i++ {
3636
log.Info("foo", "bar", "baz", "bat")
3737
}
3838

3939
}
4040

41-
func BenchmarkGloggerEnabledStreamHandler(b *testing.B) {
42-
glogHandler := log.NewGlogHandler(log.StreamHandler(io.Discard, log.TerminalFormat(false)))
43-
glogHandler.Verbosity(log.LvlInfo)
44-
log.Root().SetHandler(glogHandler)
41+
func BenchmarkGloggerTerminal(b *testing.B) {
42+
glogHandler := log.NewGlogHandler(log.TerminalHandler(io.Discard, false))
43+
glogHandler.Verbosity(log.LevelInfo)
44+
log.SetDefault(log.NewLogger(glogHandler))
45+
46+
for i := 0; i < b.N; i++ {
47+
log.Info("foo", "bar", "baz", "bat")
48+
}
49+
50+
}
51+
52+
func BenchmarkGloggerLogfmt(b *testing.B) {
53+
glogHandler := log.NewGlogHandler(log.LogfmtHandler(io.Discard))
54+
glogHandler.Verbosity(log.LevelInfo)
55+
log.SetDefault(log.NewLogger(glogHandler))
56+
57+
for i := 0; i < b.N; i++ {
58+
log.Info("foo", "bar", "baz", "bat")
59+
}
60+
61+
}
62+
63+
func BenchmarkGloggerJson(b *testing.B) {
64+
glogHandler := log.NewGlogHandler(log.TerminalHandler(io.Discard, false))
65+
glogHandler.Verbosity(log.LevelInfo)
66+
log.SetDefault(log.NewLogger(glogHandler))
4567

4668
for i := 0; i < b.N; i++ {
4769
log.Info("foo", "bar", "baz", "bat")

go.mod

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,8 @@ go 1.20
55
require github.com/ethereum/go-ethereum v1.13.2
66

77
require (
8-
github.com/bits-and-blooms/bitset v1.5.0 // indirect
9-
github.com/btcsuite/btcd/btcec/v2 v2.2.0 // indirect
10-
github.com/consensys/bavard v0.1.13 // indirect
11-
github.com/consensys/gnark-crypto v0.10.0 // indirect
12-
github.com/crate-crypto/go-kzg-4844 v0.3.0 // indirect
13-
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 // indirect
14-
github.com/ethereum/c-kzg-4844 v0.3.1 // indirect
15-
github.com/go-stack/stack v1.8.1 // indirect
168
github.com/holiman/uint256 v1.2.3 // indirect
17-
github.com/mmcloughlin/addchain v0.4.0 // indirect
18-
github.com/supranational/blst v0.3.11 // indirect
19-
golang.org/x/crypto v0.12.0 // indirect
20-
golang.org/x/exp v0.0.0-20230810033253-352e893a4cad // indirect
21-
golang.org/x/sync v0.3.0 // indirect
22-
golang.org/x/sys v0.11.0 // indirect
23-
rsc.io/tmplfunc v0.0.3 // indirect
9+
golang.org/x/exp v0.0.0-20230905200255-921286631fa9 // indirect
2410
)
2511

26-
replace github.com/ethereum/go-ethereum => github.com/jwasinger/go-ethereum v1.10.9-0.20231002121640-00ceac2773f9
12+
replace github.com/ethereum/go-ethereum => github.com/jwasinger/go-ethereum v1.10.9-0.20231024102021-926ea2e9618d

go.sum

Lines changed: 4 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,6 @@
1-
github.com/bits-and-blooms/bitset v1.5.0 h1:NpE8frKRLGHIcEzkR+gZhiioW1+WbYV6fKwD6ZIpQT8=
2-
github.com/bits-and-blooms/bitset v1.5.0/go.mod h1:gIdJ4wp64HaoK2YrL1Q5/N7Y16edYb8uY+O0FJTyyDA=
3-
github.com/btcsuite/btcd/btcec/v2 v2.2.0 h1:fzn1qaOt32TuLjFlkzYSsBC35Q3KUjT1SwPxiMSCF5k=
4-
github.com/btcsuite/btcd/btcec/v2 v2.2.0/go.mod h1:U7MHm051Al6XmscBQ0BoNydpOTsFAn707034b5nY8zU=
5-
github.com/consensys/bavard v0.1.13 h1:oLhMLOFGTLdlda/kma4VOJazblc7IM5y5QPd2A/YjhQ=
6-
github.com/consensys/bavard v0.1.13/go.mod h1:9ItSMtA/dXMAiL7BG6bqW2m3NdSEObYWoH223nGHukI=
7-
github.com/consensys/gnark-crypto v0.10.0 h1:zRh22SR7o4K35SoNqouS9J/TKHTyU2QWaj5ldehyXtA=
8-
github.com/consensys/gnark-crypto v0.10.0/go.mod h1:Iq/P3HHl0ElSjsg2E1gsMwhAyxnxoKK5nVyZKd+/KhU=
9-
github.com/crate-crypto/go-kzg-4844 v0.3.0 h1:UBlWE0CgyFqqzTI+IFyCzA7A3Zw4iip6uzRv5NIXG0A=
10-
github.com/crate-crypto/go-kzg-4844 v0.3.0/go.mod h1:SBP7ikXEgDnUPONgm33HtuDZEDtWa3L4QtN1ocJSEQ4=
11-
github.com/decred/dcrd/crypto/blake256 v1.0.0/go.mod h1:sQl2p6Y26YV+ZOcSTP6thNdn47hh8kt6rqSlvmrXFAc=
12-
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 h1:YLtO71vCjJRCBcrPMtQ9nqBsqpA1m5sE92cU+pd5Mcc=
13-
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1/go.mod h1:hyedUtir6IdtD/7lIxGeCxkaw7y45JueMRL4DIyJDKs=
14-
github.com/ethereum/c-kzg-4844 v0.3.1 h1:sR65+68+WdnMKxseNWxSJuAv2tsUrihTpVBTfM/U5Zg=
15-
github.com/ethereum/c-kzg-4844 v0.3.1/go.mod h1:VewdlzQmpT5QSrVhbBuGoCdFJkpaJlO1aQputP83wc0=
16-
github.com/go-stack/stack v1.8.1 h1:ntEHSVwIt7PNXNpgPmVfMrNhLtgjlmnZha2kOpuRiDw=
17-
github.com/go-stack/stack v1.8.1/go.mod h1:dcoOX6HbPZSZptuspn9bctJ+N/CnF5gGygcUP3XYfe4=
18-
github.com/google/subcommands v1.2.0/go.mod h1:ZjhPrFU+Olkh9WazFPsl27BQ4UPiG37m3yTrtFlrHVk=
191
github.com/holiman/uint256 v1.2.3 h1:K8UWO1HUJpRMXBxbmaY1Y8IAMZC/RsKB+ArEnnK4l5o=
202
github.com/holiman/uint256 v1.2.3/go.mod h1:SC8Ryt4n+UBbPbIBKaG9zbbDlp4jOru9xFZmPzLUTxw=
21-
github.com/jwasinger/go-ethereum v1.10.9-0.20230929135352-3167113c2857 h1:JrEfNPkFlgxvJdnuua+c3dyeFz4q1PNbhxAvc6mPDjY=
22-
github.com/jwasinger/go-ethereum v1.10.9-0.20230929135352-3167113c2857/go.mod h1:gkQ5Ygi64ZBh9M/4iXY1R8WqoNCx1Ey0CkYn2BD4/fw=
23-
github.com/jwasinger/go-ethereum v1.10.9-0.20231002103845-ee81619614aa/go.mod h1:gkQ5Ygi64ZBh9M/4iXY1R8WqoNCx1Ey0CkYn2BD4/fw=
24-
github.com/jwasinger/go-ethereum v1.10.9-0.20231002121640-00ceac2773f9 h1:3axJ2vl2CUQm6ju5CYUarCxW6t00SubGemSpz78oesM=
25-
github.com/jwasinger/go-ethereum v1.10.9-0.20231002121640-00ceac2773f9/go.mod h1:gkQ5Ygi64ZBh9M/4iXY1R8WqoNCx1Ey0CkYn2BD4/fw=
26-
github.com/mmcloughlin/addchain v0.4.0 h1:SobOdjm2xLj1KkXN5/n0xTIWyZA2+s99UCY1iPfkHRY=
27-
github.com/mmcloughlin/addchain v0.4.0/go.mod h1:A86O+tHqZLMNO4w6ZZ4FlVQEadcoqkyU72HC5wJ4RlU=
28-
github.com/mmcloughlin/profile v0.1.1/go.mod h1:IhHD7q1ooxgwTgjxQYkACGA77oFTDdFVejUS1/tS/qU=
29-
github.com/supranational/blst v0.3.11 h1:LyU6FolezeWAhvQk0k6O/d49jqgO52MSDDfYgbeoEm4=
30-
github.com/supranational/blst v0.3.11/go.mod h1:jZJtfjgudtNl4en1tzwPIV3KjUnQUvG3/j+w+fVonLw=
31-
golang.org/x/crypto v0.12.0 h1:tFM/ta59kqch6LlvYnPa0yx5a83cL2nHflFhYKvv9Yk=
32-
golang.org/x/crypto v0.12.0/go.mod h1:NF0Gs7EO5K4qLn+Ylc+fih8BSTeIjAP05siRnAh98yw=
33-
golang.org/x/exp v0.0.0-20230810033253-352e893a4cad h1:g0bG7Z4uG+OgH2QDODnjp6ggkk1bJDsINcuWmJN1iJU=
34-
golang.org/x/exp v0.0.0-20230810033253-352e893a4cad/go.mod h1:FXUEEKJgO7OQYeo8N01OfiKP8RXMtf6e8aTskBGqWdc=
35-
golang.org/x/sync v0.3.0 h1:ftCYgMx6zT/asHUrPw8BLLscYtGznsLAnjq5RH9P66E=
36-
golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y=
37-
golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM=
38-
golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
39-
rsc.io/tmplfunc v0.0.3 h1:53XFQh69AfOa8Tw0Jm7t+GV7KZhOi6jzsCzTtKbMvzU=
40-
rsc.io/tmplfunc v0.0.3/go.mod h1:AG3sTPzElb1Io3Yg4voV9AGZJuleGAwaVRxL9M49PhA=
3+
github.com/jwasinger/go-ethereum v1.10.9-0.20231024102021-926ea2e9618d h1:lzysLIRrwVcyUbwg7xKM/eA4ba1UfMHOdATUyj0LlmM=
4+
github.com/jwasinger/go-ethereum v1.10.9-0.20231024102021-926ea2e9618d/go.mod h1:I0U5VewuuTzvBtVzKo7b3hJzDhXOUtn9mJW7SsIPB0Q=
5+
golang.org/x/exp v0.0.0-20230905200255-921286631fa9 h1:GoHiUyI/Tp2nVkLI2mCxVkOjsbSXD66ic0XW0js0R9g=
6+
golang.org/x/exp v0.0.0-20230905200255-921286631fa9/go.mod h1:S2oDrQGGwySpoQPVqRShND87VCbxmc6bL1Yd2oYrm6k=

0 commit comments

Comments
 (0)