Skip to content

Glossary: Go Beyond the Basics

slog.New / NewTextHandler / NewJSONHandler

Also written: slog.New, NewTextHandler, NewJSONHandler, slog.SetDefault

`NewTextHandler` writes `key=value` lines and `NewJSONHandler` writes one JSON object per line. `slog.New` makes a logger from either.

Where the book teaches it

Related terms

slog.Loggerhandler (slog)