qlogwriter

package
v0.59.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 11, 2026 License: MIT Imports: 10 Imported by: 3

Documentation

Index

Constants

View Source
const RecordSeparator byte = 0x1e

RecordSeparator is the record separator byte for the JSON-SEQ format

Variables

This section is empty.

Functions

This section is empty.

Types

type ConnectionID

type ConnectionID = protocol.ConnectionID

type Event

type Event interface {
	// Name returns the name of the event, as it should appear in the qlog output
	Name() string
	// Encode writes the event's data to the provided jsontext.Encoder
	Encode(encoder *jsontext.Encoder, eventTime time.Time) error
}

Event represents a qlog event that can be encoded to JSON. Each event must provide its name and a method to encode itself using a jsontext.Encoder.

type FileSeq

type FileSeq struct {
	// contains filtered or unexported fields
}

FileSeq represents a qlog trace using the JSON-SEQ format, https://www.ietf.org/archive/id/draft-ietf-quic-qlog-main-schema-12.html#section-5 qlog event producers can be created by calling AddProducer. The underlying io.WriteCloser is closed when the last producer is removed.

func NewConnectionFileSeq

func NewConnectionFileSeq(w io.WriteCloser, isClient bool, odcid ConnectionID, eventSchemas []string) *FileSeq

NewConnectionFileSeq creates a new qlog trace to log connection events.

func NewFileSeq

func NewFileSeq(w io.WriteCloser) *FileSeq

NewFileSeq creates a new JSON-SEQ qlog trace to log transport events.

func (*FileSeq) AddProducer

func (t *FileSeq) AddProducer() Recorder

func (*FileSeq) Run

func (t *FileSeq) Run()

func (*FileSeq) SupportsSchemas

func (t *FileSeq) SupportsSchemas(schema string) bool

type Recorder

type Recorder interface {
	// RecordEvent records a single Event to the trace.
	// It must not be called after Close.
	RecordEvent(Event)
	// Close signals that this producer is done recording events.
	// When all producers are closed, the underlying trace is closed.
	// It must not be called concurrently with RecordEvent.
	io.Closer
}

Recorder is used to record events to a qlog trace. It is safe for concurrent use by multiple goroutines.

type Trace

type Trace interface {
	// AddProducer creates a new Recorder for this trace.
	// Each Recorder can record events independently.
	AddProducer() Recorder

	// SupportsSchemas returns true if the trace supports the given schema.
	SupportsSchemas(schema string) bool
}

Trace represents a qlog trace that can have multiple event producers. Each producer can record events to the trace independently. When the last producer is closed, the underlying trace is closed as well.

type Writer

type Writer struct {
	// contains filtered or unexported fields
}

func (*Writer) Close

func (w *Writer) Close() error

func (*Writer) RecordEvent

func (w *Writer) RecordEvent(ev Event)

Directories

Path Synopsis
Package jsontext provides a fast JSON encoder providing only the necessary features for qlog encoding.
Package jsontext provides a fast JSON encoder providing only the necessary features for qlog encoding.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL