8000
Skip to content

Releases: ipfs/go-log

v2.9.0

05 Nov 23:46
990fbe1

Choose a tag to compare

The Problem

go-libp2p 0.44 switched from go-log to slog, which broke visibility of go-libp2p logs for applications using go-log. Applications could no longer see go-libp2p logs or adjust their levels at runtime (see kubo#11035).

go-libp2p maintainers evaluated two options presented by Kubo maintainers for addressing this (details): fix the breaking change in go-libp2p, or require each application to add integration code. The manual integration approach was selected.

The Fix

This release adds SlogHandler() to bridge slog-based libraries back into go-log. Applications using go-log (>=2.9)+go-libp2p(>=0.45) need to add this to their init():

import (
    "log/slog"
    golog "github.com/ipfs/go-log/v2"
    "github.com/libp2p/go-libp2p/gologshim"
)

func init() {
    // Route all slog logs through go-log
    slog.SetDefault(slog.New(golog.SlogHandler()))

    // Connect go-libp2p to go-log
    gologshim.SetDefaultHandler(golog.SlogHandler())
}

After adding this:

  • go-libp2p logs appear in application output again
  • SetLogLevel("libp2p-swarm", "debug") works again
  • logs can be piped to dynamically created sinks, like ipfs log tail
  • All logs use go-log's formatting (JSON/color/nocolor)

More Info

See the README: Slog integration for details.

Full Changelog: v2.8.2...v2.9.0

Note

This release was brought to you by the Shipyard team.

v2.8.2

08 Oct 07:32
77c15ef

Choose a tag to compare

What's Changed

New Contributors

Full Changelog: v2.8.1...v2.8.2

v2.8.1

14 Aug 07:33
1a00721

Choose a tag to compare

What's Changed

  • Replace uber-go/multierr with errors.Join by @gammazero in #168
  • feat: add LevelEnabled function to check if log level enabled by @gammazero in #170

Full Changelog: v2.8.0...v2.8.1

v2.8.0

30 Jul 23:15
3df4734

Choose a tag to compare

What's Changed

Breaking changes to API introduced in v2.7.0

  • Removed LevelName
  • Renamed LevelFromString to Parse
  • Renamed GetLogLevel to SubsystemLevelName
  • Renamed GetAllLogLevels to SubsystemLevelNames
  • Name of default level identified by DefaultName instead of "" or "*"

Full Changelog: v2.7.0...v2.8.0

v2.7.0

29 Jul 09:29
f80c870

Choose a tag to compare

What's Changed

New Contributors

Full Changelog: v2.6.0...v2.7.0

This release was brought to you by the Shipyard team.

v2.6.0

06 May 22:28
dbee19f

Choose a tag to compare

What's Changed

New Contributors

Full Changelog: v2.5.1...v2.6.0

This release was brought to you by the Shipyard team.

v2.5.0

09 Jan 06:12
604185d

Choose a tag to compare

What's Changed

New Contributors

Full Changelog: v2.4.0...v2.5.0

v2.4.0

07 Jan 12:02
8a3d301

Choose a tag to compare

What's Changed

New Contributors

  • @moul made their first contribution in #121

Full Changelog: v2.3.0...v2.4.0

Release v2.3.0

07 Jul 09:01
2c2975b

Choose a tag to compare

Features:

  • Do not output ANSI-color sequences unless one of the outputs is a TTY.
  • New format type GOLOG_LOG_FMT=color for cases when capturing color in a file is desirable

Release v2.1.3

18 Mar 23:42
v2.1.3
fc55b72

Choose a tag to compare

Update deps.

0