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 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.
Click to show internal directories.
Click to hide internal directories.