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 ¶
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 Trailing ¶ added in v0.12.5
func Trailing() Option
Trailing returns an Option that renders the elapsed field last on the row, after any fields added at runtime via a live Update. Use when elapsed is a persistent timer that should always trail the row's own attrs.
func WithGradient ¶ added in v0.11.19
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
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
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.
func WithOmitOnDone ¶ added in v0.13.1
WithOmitOnDone returns an Option that controls whether an animated elapsed field is omitted from the fx.Builder done row.