Documentation
¶
Overview ¶
Package elapsed provides elapsed time field configuration for clog.
Index ¶
- func FormatFunc() func(time.Duration) string
- func GradientMax() time.Duration
- func Minimum() time.Duration
- func Precision() int
- func Restore(s Snapshot)
- func Round() time.Duration
- func SetFormatFunc(fn func(time.Duration) string)
- func SetGradientMax(d time.Duration)
- func SetMinimum(d time.Duration)
- func SetPrecision(n int)
- func SetRound(d time.Duration)
- type Snapshot
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FormatFunc ¶
FormatFunc returns the current custom format function, or nil if using default.
func GradientMax ¶
GradientMax returns the current gradient max duration. 0 means gradient is disabled.
func Restore ¶
func Restore(s Snapshot)
Restore resets the elapsed configuration to a previously saved Snapshot.
func SetFormatFunc ¶
SetFormatFunc configures a custom format function for elapsed durations. When set, this function is used instead of the default formatter. Pass nil to restore the default.
func SetGradientMax ¶
SetGradientMax sets the max duration for elapsed gradient coloring. The gradient maps 0 → max onto the configured color stops. Set to 0 (the default) to disable gradient coloring.
func SetMinimum ¶
SetMinimum sets the minimum duration below which elapsed fields are hidden. Defaults to time.Second. Set to 0 to show all values.
func SetPrecision ¶
func SetPrecision(n int)
SetPrecision sets the decimal precision for elapsed time formatting. For example, 0 = "3s", 1 = "3.2s", 2 = "3.21s". Defaults to 0.
func SetRound ¶
SetRound sets the rounding duration for elapsed time values. Defaults to time.Second. Set to 0 to disable rounding.