prefixgen

package
v0.14.1-0...-8b31b97 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2021 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package prefixgen is a prefix generation helper for log messages and any other kind.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(p *Prefixer)

Option configures Prefixer.

func Color

func Color(color uint8) Option

Color sets color to the prefix.

func Common

func Common(options ...Option) []Option

Common holds some common prefix options and extends those options by given options.

func SpaceRight

func SpaceRight() Option

SpaceRight adds rights space to the prefix.

func SquareBrackets

func SquareBrackets() Option

SquareBrackets adds square brackets to the prefix.

func Uppercase

func Uppercase() Option

Uppercase formats the prefix to uppercase.

type Prefixer

type Prefixer struct {
	// contains filtered or unexported fields
}

Prefixer generates prefixes.

func New

func New(format string, options ...Option) *Prefixer

New creates a new Prefixer with format and options. Format is an fmt.Sprintf() like format to dynamically create prefix texts as needed.

func (*Prefixer) Gen

func (p *Prefixer) Gen(s ...interface{}) string

Gen generates a new prefix by applying s to format given during New().

Jump to

Keyboard shortcuts

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