percent

package
v0.11.10 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package percent provides options for percent field rendering in clog.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Apply

func Apply(p *Percent, opts ...Option)

Apply applies the given options to p.

func EffectiveMaximum added in v0.7.0

func EffectiveMaximum(p Percent, def float64) float64

EffectiveMaximum returns the per-field maximum if set, otherwise def. A def of 0 (or any non-positive value) means the documented default of 1.0.

Types

type Option

type Option func(*Percent)

Option configures how a percent field is rendered.

func WithMaximum added in v0.7.0

func WithMaximum(m float64) Option

WithMaximum returns an Option that overrides the logger's percent maximum for this field. For example, use WithMaximum(100) when passing values in the 0–100 range instead of the default 0–1 range.

func WithReverseGradient

func WithReverseGradient() Option

WithReverseGradient returns an Option that flips the gradient direction for this field relative to the logger default. If the logger is using the normal gradient (red=0%, green=100%), the field renders inverted (green=0%, red=100%), and vice versa.

type Percent

type Percent = core.Percent

Percent is the value type for percent fields.

Jump to

Keyboard shortcuts

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