elapsed

package
v0.12.4 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package elapsed provides options for elapsed-time field rendering in clog.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Apply added in v0.11.19

func Apply(e *Elapsed, opts ...Option)

Apply applies the given options to e.

Types

type Elapsed added in v0.11.19

type Elapsed = core.ElapsedField

Elapsed is the value type for elapsed-time fields.

type Option added in v0.11.19

type Option func(*Elapsed)

Option configures how an elapsed-time field is rendered.

func WithGradient added in v0.11.19

func WithGradient(stops ...style.ColorStop) Option

WithGradient returns an Option that overrides the logger's elapsed gradient color stops for this field.

clog.Info().Elapsed("elapsed", elapsed.WithGradient(
    style.ColorStop{Position: 0, Color: green},
    style.ColorStop{Position: 1, Color: red},
))

func WithGradientMax added in v0.11.19

func WithGradientMax(maximum time.Duration) Option

WithGradientMax returns an Option that overrides the logger's elapsed gradient maximum for this field. The gradient runs from the first stop at 0 to the last stop at max.

clog.Info().Elapsed("elapsed", elapsed.WithGradientMax(3*time.Second))

func WithGradientMode added in v0.11.19

func WithGradientMode(mode style.GradientMode) Option

WithGradientMode returns an Option that overrides the logger's elapsed gradient transition mode (style.GradientFade or style.GradientStep) for this field.

func WithMinimum added in v0.11.20

func WithMinimum(minimum time.Duration) Option

WithMinimum returns an Option that overrides the logger's elapsed minimum threshold for this field - the field is hidden entirely when its duration falls below minimum.

Jump to

Keyboard shortcuts

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