You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
refactor: explicit slog integration via slog.SetDefault()
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
Each log entry will include these labels in JSON format:
122
-
123
-
```json
124
-
{
125
-
"level": "info",
126
-
"ts": "2025-01-05T10:30:00.000Z",
127
-
"logger": "core",
128
-
"msg": "daemon started",
129
-
"app": "kubo",
130
-
"dc": "us-west-1",
131
-
"instance": "node-42"
132
-
}
133
-
```
134
-
135
-
## `GOLOG_CAPTURE_DEFAULT_SLOG`
136
-
137
-
Controls whether go-log installs its bridge as Go's default slog handler via `slog.SetDefault()`.
138
-
139
-
When enabled (default), go-log captures logs from:
140
-
- Go standard library packages using `log/slog`
141
-
- Third-party libraries using `log/slog`
142
-
- go-libp2p (which uses slog internally via gologshim)
143
-
144
-
This allows unified log management where `ipfs log level` commands control both Kubo subsystems and go-libp2p loggers.
145
-
146
-
To disable the slog bridge:
147
-
148
-
```console
149
-
export GOLOG_CAPTURE_DEFAULT_SLOG="false"
150
-
ipfs daemon
151
-
```
152
-
153
-
When disabled, only native go-log loggers will be captured. Libraries using `log/slog` directly will use Go's default handler and won't appear in `ipfs log tail` or respond to `ipfs log level` commands.
154
-
155
-
Default: `true` (enabled)
156
-
157
-
For more details, see [go-log's slog integration documentation](https://github.com/ipfs/go-log/blob/master/README.md#slog-integration).
158
-
159
105
## `GOLOG_TRACING_FILE`
160
106
161
107
Sets the file to which Kubo sends tracing events. By default, tracing is
0 commit comments