github.com/shogo82148/std@v1.22.1-0.20240327122250-4e474527810c/internal/trace/v2/raw/textwriter.go (about) 1 // Copyright 2023 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 package raw 6 7 import ( 8 "github.com/shogo82148/std/io" 9 10 "github.com/shogo82148/std/internal/trace/v2/version" 11 ) 12 13 // TextWriter emits the text format of a trace. 14 type TextWriter struct { 15 w io.Writer 16 v version.Version 17 } 18 19 // NewTextWriter creates a new write for the trace text format. 20 func NewTextWriter(w io.Writer, v version.Version) (*TextWriter, error) 21 22 // WriteEvent writes a single event to the stream. 23 func (w *TextWriter) WriteEvent(e Event) error