Help us shape the future of Go! Take the 2026 Go Developer Survey

laps

package
v1.87.2 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2026 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package laps times the consecutive steps of one operation for its log line.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Laps

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

Laps holds how long each step of an operation took. A nil *Laps times nothing, so a step can be lapped whether or not anyone asked for it.

func Start

func Start() *Laps

Start begins timing the first step now.

func (*Laps) Attrs

func (l *Laps) Attrs() []any

Attrs returns each step and its duration as alternating key-value arguments for slog.

func (*Laps) Lap

func (l *Laps) Lap(step string)

Lap ends the current step, naming it step, and begins the next.

Jump to

Keyboard shortcuts

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