duration

package
v0.13.0 Latest Latest
Warning

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

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

Documentation

Overview

Package duration provides options for time.Duration 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(d *Duration, opts ...Option)

Apply applies the given options to d.

Types

type Duration added in v0.11.19

type Duration = core.DurationField

Duration is the value type for duration fields.

type Option added in v0.11.19

type Option func(*Duration)

Option configures how a duration 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 duration gradient color stops for this field.

func WithGradientMax added in v0.11.19

func WithGradientMax(maximum time.Duration) Option

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

clog.Info().Duration("latency", d, duration.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 duration gradient transition mode (style.GradientFade or style.GradientStep) for this field.

func WithMinimum added in v0.12.6

func WithMinimum(minimum time.Duration) Option

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

Jump to

Keyboard shortcuts

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