slog is a minimal structured logging library for Go.
go get cdr.dev/slog
json.MarshalMany more examples available at godoc.
log := slog.Make(sloghuman.Sink(os.Stdout))
log.Info(context.Background(), "my message here",
slog.F("field_name", "something or the other"),
slog.F("some_map", slog.M(
slog.F("nested_fields", time.Date(2000, time.February, 5, 4, 4, 4, 0, time.UTC)),
)),
slog.Error(
xerrors.Errorf("wrap1: %w",
xerrors.Errorf("wrap2: %w",
io.EOF,
),
),
),
)

At Coder we’ve used Uber’s zap for several years. It is a fantastic library for performance. Thanks Uber!
However we felt the API and developer experience could be improved.
Here is a list of reasons how we improved on zap with slog.
slog has a minimal API surface
slog has a concise semi typed API
sloghuman uses a very human readable format
golang.org/x/xerrors chain
into an array with fields for the location and wrapping messages.Full context.Context support
slog lets you set fields in a context.Context such that any log with the context prints those fields.Simple and easy to extend
Structured logging of Go structures with json.Marshal
fmt.Stringer and using zap.Stringer instead.slog takes inspiration from Go's stdlib and implements slog.Helper
which works just like t.Helper
Tight integration with stdlib's testing package
slogtest to exit on any ERROR logs
and it has a global stateless API that takes a testing.TB so you do not need to create a logger first.Overall
Maintained
Code review
Go module
Latest release
Releases this year
41 followers · starred Dec 2019
259 followers · starred Aug 2026
slog is a minimal structured logging library for Go.
go get cdr.dev/slog
json.MarshalMany more examples available at godoc.
log := slog.Make(sloghuman.Sink(os.Stdout))
log.Info(context.Background(), "my message here",
slog.F("field_name", "something or the other"),
slog.F("some_map", slog.M(
slog.F("nested_fields", time.Date(2000, time.February, 5, 4, 4, 4, 0, time.UTC)),
)),
slog.Error(
xerrors.Errorf("wrap1: %w",
xerrors.Errorf("wrap2: %w",
io.EOF,
),
),
),
)

At Coder we’ve used Uber’s zap for several years. It is a fantastic library for performance. Thanks Uber!
However we felt the API and developer experience could be improved.
Here is a list of reasons how we improved on zap with slog.
slog has a minimal API surface
slog has a concise semi typed API
sloghuman uses a very human readable format
golang.org/x/xerrors chain
into an array with fields for the location and wrapping messages.Full context.Context support
slog lets you set fields in a context.Context such that any log with the context prints those fields.Simple and easy to extend
Structured logging of Go structures with json.Marshal
fmt.Stringer and using zap.Stringer instead.slog takes inspiration from Go's stdlib and implements slog.Helper
which works just like t.Helper
Tight integration with stdlib's testing package
slogtest to exit on any ERROR logs
and it has a global stateless API that takes a testing.TB so you do not need to create a logger first.Overall
Maintained
Code review
Go module
Latest release
Releases this year
41 followers · starred Dec 2019
259 followers · starred Aug 2026