stopwatch

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2022 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package stopwatch is used to time things. Create a stopwatch with Start, then on success record the timing with Finish.

It's recommended you do not record errors, since they can have vastly different timings (maybe we add an Error method in the future and record a different event).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FinishOpts

type FinishOpts struct {
	Logger       *logrus.Entry
	Key          string
	ElapsedKey   string
	Milliseconds bool
	Level        logrus.Level
}

type LapOpts

type LapOpts FinishOpts

type StartOpts

type StartOpts struct {
	Key   string
	Level logrus.Level
}

type Stopwatch

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

func Start

func Start(logger *logrus.Entry, operation string) *Stopwatch

func StartWith

func StartWith(logger *logrus.Entry, operation string, opts StartOpts) *Stopwatch

func (*Stopwatch) Finish

func (sw *Stopwatch) Finish()

func (*Stopwatch) FinishWith

func (sw *Stopwatch) FinishWith(opts FinishOpts)

func (*Stopwatch) Lap

func (sw *Stopwatch) Lap()

func (*Stopwatch) LapWith

func (sw *Stopwatch) LapWith(opts LapOpts)

Jump to

Keyboard shortcuts

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