format

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2021 License: Apache-2.0 Imports: 6 Imported by: 15

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Debug = Style{color.Color(99), level.Debug, "DEBUG", "✚", "", "", nil, nil}
	Error = Style{color.Color(208), level.Error, "ERROR", "✗", "", "", nil, nil}
	Fatal = Style{color.Color(160), level.Fatal, "FATAL", "🕱", "", "", nil, nil}
	Good  = Style{color.Color(40), level.Good, "GOOD", "🗸", "", "", nil, nil}
	Info  = Style{color.Color(45), level.Info, "INFO", "⮞", "", "", nil, nil}
	Panic = Style{color.Color(200), level.Panic, "PANIC", "☢", "", "", nil, nil}
	Warn  = Style{color.Color(220), level.Warn, "WARNING", "🗲", "", "", nil, nil}
)

Debug style used for prints

Functions

func Full

func Full(s Style, time string, v ...interface{}) string

Full prints a complete log message, with a timestep and label for message type

func Min

func Min(s Style, time string, v ...interface{}) string

Min prints a simplified log message, with only an icon for message type

func Partial added in v1.0.5

func Partial(s Style, time string, v ...interface{}) string

Partial prints a partial log message, with a timestep and icon for message type

func Un

func Un(s Style, time string, v ...interface{}) string

Un prints a Full-style log message, without colors

Types

type Func added in v1.1.0

type Func func(s Style, time string, v ...interface{}) string

Func defines a format function to use for printing

type Style

type Style struct {
	Color  color.Color
	Level  uint8
	Msg    string
	Symbol string
	// contains filtered or unexported fields
}

Style is a style definition used for prints

func (Style) BG added in v1.2.0

func (s Style) BG() string

BG provides the foreground color of this Style as a string

func (Style) BGFunc added in v1.2.0

func (s Style) BGFunc() style.Style

BGFunc provides the foreground color of this Style as a function

func (Style) FG added in v1.2.0

func (s Style) FG() string

FG provides the foreground color of this Style as a string

func (Style) FGFunc added in v1.2.0

func (s Style) FGFunc() style.Style

FGFunc provides the foreground color of this Style as a function

Jump to

Keyboard shortcuts

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