File tree Expand file tree Collapse file tree 7 files changed +12
-24
lines changed
docs/examples/kubo-as-a-library Expand file tree Collapse file tree 7 files changed +12
-24
lines changed Original file line number Diff line number Diff line change 88 "errors"
99 "fmt"
1010 "io"
11- "log/slog"
1211 "net"
1312 "net/http"
1413 "os"
@@ -57,20 +56,9 @@ func init() {
5756 // This ensures go-libp2p logs integrate with go-log's formatting
5857 // and dynamic level control (e.g., `ipfs log level libp2p-swarm debug`).
5958 //
60- // go-log's init() installs its slog bridge via slog.SetDefault().
61- // We pass that handler to gologshim so go-libp2p loggers use it.
62- handler := slog .Default ().Handler ()
63-
64- // Verify that slog.Default() is go-log's bridge via duck typing.
65- // This catches misconfigurations where go-log's init() didn't run.
66- type goLogBridge interface {
67- GoLogBridge ()
68- }
69- if _ , ok := handler .(goLogBridge ); ! ok {
70- panic ("aborting startup: slog.Default() is not go-log's bridge, go-libp2p logs would be missing due to incorrect wiring" )
71- }
72-
73- gologshim .SetDefaultHandler (handler )
59+ // Use SlogHandler() to get go-log's bridge directly.
60+ // This works even when GOLOG_CAPTURE_DEFAULT_SLOG=false.
61+ gologshim .SetDefaultHandler (logging .SlogHandler ())
7462}
7563
7664// declared as a var for testing purposes.
Original file line number Diff line number Diff line change @@ -93,7 +93,7 @@ require (
9393 github.com/ipfs/go-ipld-format v0.6.3 // indirect
9494 github.com/ipfs/go-ipld-git v0.1.1 // indirect
9595 github.com/ipfs/go-ipld-legacy v0.2.2 // indirect
96- github.com/ipfs/go-log/v2 v2.8.3-0.20251104190326-eea1e4119c49 // indirect
96+ github.com/ipfs/go-log/v2 v2.8.3-0.20251105191458-101e2c1ac85a // indirect
9797 github.com/ipfs/go-metrics-interface v0.3.0 // indirect
9898 github.com/ipfs/go-peertaskqueue v0.8.2 // indirect
9999 github.com/ipfs/go-test v0.2.3 // indirect
Original file line number Diff line number Diff line change @@ -349,8 +349,8 @@ github.com/ipfs/go-ipld-git v0.1.1/go.mod h1:+VyMqF5lMcJh4rwEppV0e6g4nCCHXThLYYD
349349github.com/ipfs/go-ipld-legacy v0.2.2 h1:DThbqCPVLpWBcGtU23KDLiY2YRZZnTkXQyfz8aOfBkQ =
350350github.com/ipfs/go-ipld-legacy v0.2.2 /go.mod h1:hhkj+b3kG9b2BcUNw8IFYAsfeNo8E3U7eYlWeAOPyDU =
351351github.com/ipfs/go-log v0.0.1 /go.mod h1:kL1d2/hzSpI0thNYjiKfjanbVNU+IIGA/WnNESY9leM =
352- github.com/ipfs/go-log/v2 v2.8.3-0.20251104190326-eea1e4119c49 h1:IeFkT7voVHOd7KsTTfXlIh4WIV9m7+UYLFuxLp6a5PM =
353- github.com/ipfs/go-log/v2 v2.8.3-0.20251104190326-eea1e4119c49 /go.mod h1:UhIYAwMV7Nb4ZmihUxfIRM2Istw/y9cAk3xaK+4Zs2c =
352+ github.com/ipfs/go-log/v2 v2.8.3-0.20251105191458-101e2c1ac85a h1:ZtrWQty1MnTu5sJFWpX01KIAEgqmyVphKTmdIbuspm0 =
353+ github.com/ipfs/go-log/v2 v2.8.3-0.20251105191458-101e2c1ac85a /go.mod h1:UhIYAwMV7Nb4ZmihUxfIRM2Istw/y9cAk3xaK+4Zs2c =
354354github.com/ipfs/go-metrics-interface v0.3.0 h1:YwG7/Cy4R94mYDUuwsBfeziJCVm9pBMJ6q/JR9V40TU =
355355github.com/ipfs/go-metrics-interface v0.3.0 /go.mod h1:OxxQjZDGocXVdyTPocns6cOLwHieqej/jos7H4POwoY =
356356github.com/ipfs/go-peertaskqueue v0.8.2 h1:PaHFRaVFdxQk1Qo3OKiHPYjmmusQy7gKQUaL8JDszAU =
Original file line number Diff line number Diff line change @@ -39,7 +39,7 @@ require (
3939 github.com/ipfs/go-ipld-format v0.6.3
4040 github.com/ipfs/go-ipld-git v0.1.1
4141 github.com/ipfs/go-ipld-legacy v0.2.2
42- github.com/ipfs/go-log/v2 v2.8.3-0.20251104190326-eea1e4119c49
42+ github.com/ipfs/go-log/v2 v2.8.3-0.20251105191458-101e2c1ac85a
4343 github.com/ipfs/go-metrics-interface v0.3.0
4444 github.com/ipfs/go-metrics-prometheus v0.1.0
4545 github.com/ipfs/go-test v0.2.3
Original file line number Diff line number Diff line change @@ -416,8 +416,8 @@ github.com/ipfs/go-ipld-git v0.1.1/go.mod h1:+VyMqF5lMcJh4rwEppV0e6g4nCCHXThLYYD
416416github.com/ipfs/go-ipld-legacy v0.2.2 h1:DThbqCPVLpWBcGtU23KDLiY2YRZZnTkXQyfz8aOfBkQ =
417417github.com/ipfs/go-ipld-legacy v0.2.2 /go.mod h1:hhkj+b3kG9b2BcUNw8IFYAsfeNo8E3U7eYlWeAOPyDU =
418418github.com/ipfs/go-log v0.0.1 /go.mod h1:kL1d2/hzSpI0thNYjiKfjanbVNU+IIGA/WnNESY9leM =
419- github.com/ipfs/go-log/v2 v2.8.3-0.20251104190326-eea1e4119c49 h1:IeFkT7voVHOd7KsTTfXlIh4WIV9m7+UYLFuxLp6a5PM =
420- github.com/ipfs/go-log/v2 v2.8.3-0.20251104190326-eea1e4119c49 /go.mod h1:UhIYAwMV7Nb4ZmihUxfIRM2Istw/y9cAk3xaK+4Zs2c =
419+ github.com/ipfs/go-log/v2 v2.8.3-0.20251105191458-101e2c1ac85a h1:ZtrWQty1MnTu5sJFWpX01KIAEgqmyVphKTmdIbuspm0 =
420+ github.com/ipfs/go-log/v2 v2.8.3-0.20251105191458-101e2c1ac85a /go.mod h1:UhIYAwMV7Nb4ZmihUxfIRM2Istw/y9cAk3xaK+4Zs2c =
421421github.com/ipfs/go-metrics-interface v0.3.0 h1:YwG7/Cy4R94mYDUuwsBfeziJCVm9pBMJ6q/JR9V40TU =
422422github.com/ipfs/go-metrics-interface v0.3.0 /go.mod h1:OxxQjZDGocXVdyTPocns6cOLwHieqej/jos7H4POwoY =
423423github.com/ipfs/go-metrics-prometheus v0.1.0 h1:bApWOHkrH3VTBHzTHrZSfq4n4weOZDzZFxUXv+HyKcA =
Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ require (
88 github.com/Kubuxu/gocovmerge v0.0.0-20161216165753-7ecaa51963cd
99 github.com/golangci/golangci-lint v1.64.8
1010 github.com/ipfs/go-cidutil v0.1.0
11- github.com/ipfs/go-log/v2 v2.8.3-0.20251104190326-eea1e4119c49
11+ github.com/ipfs/go-log/v2 v2.8.3-0.20251105191458-101e2c1ac85a
1212 github.com/ipfs/go-test v0.2.3
1313 github.com/ipfs/hang-fds v0.1.0
1414 github.com/ipfs/iptb v1.4.1
Original file line number Diff line number Diff line change @@ -364,8 +364,8 @@ github.com/ipfs/go-ipld-format v0.6.3 h1:9/lurLDTotJpZSuL++gh3sTdmcFhVkCwsgx2+rA
364364github.com/ipfs/go-ipld-format v0.6.3 /go.mod h1:74ilVN12NXVMIV+SrBAyC05UJRk0jVvGqdmrcYZvCBk =
365365github.com/ipfs/go-ipld-legacy v0.2.2 h1:DThbqCPVLpWBcGtU23KDLiY2YRZZnTkXQyfz8aOfBkQ =
366366github.com/ipfs/go-ipld-legacy v0.2.2 /go.mod h1:hhkj+b3kG9b2BcUNw8IFYAsfeNo8E3U7eYlWeAOPyDU =
367- github.com/ipfs/go-log/v2 v2.8.3-0.20251104190326-eea1e4119c49 h1:IeFkT7voVHOd7KsTTfXlIh4WIV9m7+UYLFuxLp6a5PM =
368- github.com/ipfs/go-log/v2 v2.8.3-0.20251104190326-eea1e4119c49 /go.mod h1:UhIYAwMV7Nb4ZmihUxfIRM2Istw/y9cAk3xaK+4Zs2c =
367+ github.com/ipfs/go-log/v2 v2.8.3-0.20251105191458-101e2c1ac85a h1:ZtrWQty1MnTu5sJFWpX01KIAEgqmyVphKTmdIbuspm0 =
368+ github.com/ipfs/go-log/v2 v2.8.3-0.20251105191458-101e2c1ac85a /go.mod h1:UhIYAwMV7Nb4ZmihUxfIRM2Istw/y9cAk3xaK+4Zs2c =
369369github.com/ipfs/go-metrics-interface v0.3.0 h1:YwG7/Cy4R94mYDUuwsBfeziJCVm9pBMJ6q/JR9V40TU =
370370github.com/ipfs/go-metrics-interface v0.3.0 /go.mod h1:OxxQjZDGocXVdyTPocns6cOLwHieqej/jos7H4POwoY =
371371github.com/ipfs/go-peertaskqueue v0.8.2 h1:PaHFRaVFdxQk1Qo3OKiHPYjmmusQy7gKQUaL8JDszAU =
You can’t perform that action at this time.
0 commit comments