text_handler_120.go raw

   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  
  12  	"golang.org/x/exp/slog"
  13  )
  14  
  15  // TextHandler is a Handler that writes Records to an io.Writer as a
  16  // sequence of key=value pairs separated by spaces and followed by a newline.
  17  type TextHandler = slog.TextHandler
  18  
  19  // NewTextHandler creates a TextHandler that writes to w,
  20  // using the given options.
  21  // If opts is nil, the default options are used.
  22  func NewTextHandler(w io.Writer, opts *HandlerOptions) *TextHandler {
  23  	return slog.NewTextHandler(w, opts)
  24  }
  25