record_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  	"time"
  11  
  12  	"golang.org/x/exp/slog"
  13  )
  14  
  15  // A Record holds information about a log event.
  16  // Copies of a Record share state.
  17  // Do not modify a Record after handing out a copy to it.
  18  // Call [NewRecord] to create a new Record.
  19  // Use [Record.Clone] to create a copy with no shared state.
  20  type Record = slog.Record
  21  
  22  // NewRecord creates a Record from the given arguments.
  23  // Use [Record.AddAttrs] to add attributes to the Record.
  24  //
  25  // NewRecord is intended for logging APIs that want to support a [Handler] as
  26  // a backend.
  27  func NewRecord(t time.Time, level Level, msg string, pc uintptr) Record {
  28  	return slog.NewRecord(t, level, msg, pc)
  29  }
  30  
  31  // Source describes the location of a line of source code.
  32  type Source = slog.Source
  33