Skip to content

Conversation

@lidel
Copy link
Member

@lidel lidel commented Oct 28, 2025

This PR fixes #11035 and restores ipfs log tail and ipfs log level functionality for controlling libp2p log levels.

It adds test/cli regression test to catch any future regression if go-libp2p logs get broken again on go-libp2p update.

Context

Details in libp2p/go-libp2p#3418 and ipfs/go-log#176 (especially README).

These changes restore dynamic log level control and tail for go-libp2p subsystems after the migration to slog, fixing the regression introduced in libp2p/go-libp2p#3364

TODO

This PR depends on below PRs to land first:

update go-log to v2.8.3-0.20251027235339-5fe47a4191be (feat/slog-interop)
update go-libp2p to v0.44.1-0.20251027235033-ea2c010ece2d (feat/gologshim-use-slog-default)

these changes restore dynamic log level control and tail for go-libp2p
subsystems after the migration to slog, fixing the regression introduced
in libp2p/go-libp2p#3364

Fixes #11035
@lidel lidel requested a review from gammazero October 28, 2025 00:06
@lidel lidel added the skip/changelog This change does NOT require a changelog entry label Oct 28, 2025
- wrap cmd.Process.Kill() to explicitly ignore error
- fix const alignment (go fmt)
@lidel lidel marked this pull request as ready for review October 28, 2025 16:26
@lidel lidel requested a review from a team as a code owner October 28, 2025 16:26
lidel added 3 commits November 3, 2025 19:32
resolved conflicts in go.sum files by keeping slog integration version
wire gologshim to go-log's slog bridge via init() in cmd/ipfs/kubo/start.go

update go-libp2p to v0.44.1-0.20251029234611-789d14c6effe

see libp2p/go-libp2p#3419
verify slog.Default() is go-log's bridge via duck typing before passing
to gologshim, panics with clear error if go-log's init() didn't run
@lidel
Copy link
Member Author

lidel commented Nov 3, 2025

Triage notes:

@lidel lidel mentioned this pull request Nov 3, 2025
65 tasks
update to go-libp2p v0.45.0 pre-release (3b3b1fd6) and latest go-log (eea1e41)

add documentation for GOLOG_LOG_LABELS and GOLOG_CAPTURE_DEFAULT_SLOG environment variables

see libp2p/go-libp2p#3424
lidel added 2 commits November 5, 2025 20:35
update to go-log v2.8.3-0.20251105191458-101e2c1ac85a which provides
SlogHandler() function for explicit wiring.

simplify start.go by using logging.SlogHandler() directly instead of
slog.Default().Handler() with duck-typing verification. more explicit
and works even when GOLOG_CAPTURE_DEFAULT_SLOG=false.
update to go-log v2.8.3-0.20251105220843-b453280b0ce2 which changes
GOLOG_CAPTURE_DEFAULT_SLOG to opt-in (default=false). kubo now explicitly
calls slog.SetDefault(slog.New(logging.SlogHandler())) to integrate slog
with go-log's formatting and level control.

changes:
- cmd/ipfs/kubo/start.go: add slog.SetDefault() call for application-wide
  slog integration, maintaining existing gologshim.SetDefaultHandler() for
  go-libp2p subsystem attribution
- docs/environment-variables.md: remove GOLOG_LOG_LABELS and
  GOLOG_CAPTURE_DEFAULT_SLOG sections (no longer relevant to kubo users)
- go.mod: update go-log to b453280b0ce2

while automatic slog.Default() capture was convenient, go-libp2p chose to
require explicit gologshim registration for clarity. for consistency, we
now do the same for slog.Default() - making both integration points
explicit rather than mixing automatic and manual approaches.

references:
- ipfs/go-log#176 (comment)
- ipfs/go-log@b453280
@lidel lidel changed the title fix: restore dynamic log level control and tail for go-libp2p fix([email protected]/[email protected]): dynamic log level control and tail Nov 6, 2025
@lidel
Copy link
Member Author

lidel commented Nov 6, 2025

Remove references to GOLOG_LOG_LABELS and GOLOG_CAPTURE_DEFAULT_SLOG
sections that were deleted in b04533a.
@lidel lidel merged commit f067a86 into master Nov 6, 2025
15 checks passed
@lidel lidel deleted the feat/test-slog-interop branch November 6, 2025 15:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip/changelog This change does NOT require a changelog entry

Projects

None yet

Development

Successfully merging this pull request may close these issues.

go-libp2p v0.44 logs not present in ipfs log tail

3 participants