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 // JSONHandler is a Handler that writes Records to an io.Writer as 16 // line-delimited JSON objects. 17 type JSONHandler = slog.JSONHandler 18 19 // NewJSONHandler creates a JSONHandler that writes to w, 20 // using the given options. 21 // If opts is nil, the default options are used. 22 func NewJSONHandler(w io.Writer, opts *HandlerOptions) *JSONHandler { 23 return slog.NewJSONHandler(w, opts) 24 } 25