Releases: ipfs/go-log
v2.9.0
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
What's Changed
- Require go1.24 as minimum go version by @gammazero in #169
- ci: uci/update-go by @web3-bot in #173
- fix: revert removal of LevelFromString to avoid breaking change by @rvagg in #174
New Contributors
Full Changelog: v2.8.1...v2.8.2
v2.8.1
What's Changed
- Replace
uber-go/multierrwitherrors.Joinby @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
What's Changed
- Revise the loglevel API to be more golang idiomatic by @gammazero in #165
- Test using testify package by @gammazero in #166
Breaking changes to API introduced in v2.7.0
- Removed
LevelName - Renamed
LevelFromStringtoParse - Renamed
GetLogLeveltoSubsystemLevelName - Renamed
GetAllLogLevelstoSubsystemLevelNames - Name of default level identified by
DefaultNameinstead of""or"*"
Full Changelog: v2.7.0...v2.8.0
v2.7.0
What's Changed
- feat: add GetLogLevel and GetAllLogLevels by @SgtPooki in #160
- update dependencies by @gammazero in #162
New Contributors
Full Changelog: v2.6.0...v2.7.0
This release was brought to you by the Shipyard team.
v2.6.0
What's Changed
- update dependencies including
go.uber.org/zaptov1.27.0by @gammazero in #153 - feat: only log to stderr or to stdout or both if configured by @gammazero in #154
- sync: update CI config files by @web3-bot in #134
- sync: update CI config files by @web3-bot in #137
- ci: uci/delete-templates by @web3-bot in #144
- ci: uci/copy-templates by @web3-bot in #145
- ci: uci/update-go by @web3-bot in #146
- ci: uci/copy-templates by @web3-bot in #147
- ci: uci/copy-templates by @web3-bot in #151
New Contributors
- @gammazero made their first contribution in #153
Full Changelog: v2.5.1...v2.6.0
This release was brought to you by the Shipyard team.
v2.5.0
What's Changed
- update go.uber.org/zap to v1.19.1 by @marten-seemann in #130
- Config inspection by @elijaharita in #129
New Contributors
- @elijaharita made their first contribution in #129
Full Changelog: v2.4.0...v2.5.0
v2.4.0
What's Changed
- In addition to StdOut/Err check the outfile for TTYness by @ribasushi in #117
- Add WithStacktrace untility by @Kubuxu in #118
- sync: update CI config files by @web3-bot in #119
- Document environment variables by @Stebalien in #120
- fix: cannot call SetPrimaryCore after using a Tee logger by @moul in #121
- update mattn/go-isatty to v0.0.14 by @marten-seemann in #123
New Contributors
Full Changelog: v2.3.0...v2.4.0
Release v2.3.0
Features:
- Do not output ANSI-color sequences unless one of the outputs is a TTY.
- New format type
GOLOG_LOG_FMT=colorfor cases when capturing color in a file is desirable
Release v2.1.3
Update deps.