1 // Copyright 2022 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 //go:build go1.21 6 7 package slog 8 9 import ( 10 "io" 11 "log/slog" 12 ) 13 14 // TextHandler is a Handler that writes Records to an io.Writer as a 15 // sequence of key=value pairs separated by spaces and followed by a newline. 16 type TextHandler = slog.TextHandler 17 18 // NewTextHandler creates a TextHandler that writes to w, 19 // using the given options. 20 // If opts is nil, the default options are used. 21 func NewTextHandler(w io.Writer, opts *HandlerOptions) *TextHandler { 22 return slog.NewTextHandler(w, opts) 23 } 24