qlog

package
v0.28.1 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2024 License: BSD-3-Clause Imports: 11 Imported by: 0

Documentation

Overview

Package qlog serializes qlog events.

Index

Constants

View Source
const (
	// VantageEndpoint traces contain events not specific to a single connection.
	VantageEndpoint = Vantage("endpoint")

	// VantageClient traces follow a connection from the client's perspective.
	VantageClient = Vantage("client")

	// VantageServer traces follow a connection from the server's perspective.
	VantageServer = Vantage("server")
)

Variables

This section is empty.

Functions

func NewJSONHandler

func NewJSONHandler(opts HandlerOptions) slog.Handler

NewJSONHandler returns a handler which serializes qlog events to JSON.

The handler will write an endpoint-wide trace, and a separate trace for each connection. The HandlerOptions control the location traces are written.

It uses the streamable JSON Text Sequences mapping (JSON-SEQ) defined in draft-ietf-quic-qlog-main-schema-04, Section 6.2.

A JSONHandler may be used as the handler for a quic.Config.QLogLogger. It is not a general-purpose slog handler, and may not properly handle events from other sources.

Types

type HandlerOptions

type HandlerOptions struct {
	// Level reports the minimum record level that will be logged.
	// If Level is nil, the handler assumes QLogLevelEndpoint.
	Level slog.Leveler

	// Dir is the directory in which to create trace files.
	// The handler will create one file per connection.
	// If NewTrace is non-nil or Dir is "", the handler will not create files.
	Dir string

	// NewTrace is called to create a new trace.
	// If NewTrace is nil and Dir is set,
	// the handler will create a new file in Dir for each trace.
	NewTrace func(TraceInfo) (io.WriteCloser, error)
}

HandlerOptions are options for a JSONHandler.

type TraceInfo

type TraceInfo struct {
	// Vantage is the vantage point of the trace.
	Vantage Vantage

	// GroupID identifies the logical group the trace belongs to.
	// For a connection trace, the group will be the same for
	// both the client and server vantage points.
	GroupID string
}

TraceInfo contains information about a trace.

type Vantage

type Vantage string

Vantage is the vantage point of a trace.

Jump to

Keyboard shortcuts

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