logutil

package
v0.5.4 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2023 License: MIT Imports: 17 Imported by: 0

Documentation

Overview

Package logutil GENERATED BY gengo:enum DON'T EDIT THIS FILE

Package logutil GENERATED BY gengo:runtimedoc DON'T EDIT THIS FILE

Index

Constants

This section is empty.

Variables

View Source
var NoColor = noColorExists() || os.Getenv("TERM") == "dumb" ||
	(!isatty.IsTerminal(os.Stdout.Fd()) && !isatty.IsCygwinTerminal(os.Stdout.Fd()))

Functions

func GoLogrFromContext

func GoLogrFromContext(ctx context.Context) gologr.Logger

func WithColor

func WithColor(attrs ...Attribute) func(w io.Writer) io.Writer

Types

type Attribute

type Attribute int
const (
	Reset Attribute = iota
	Bold
	Faint
	Italic
	Underline
	BlinkSlow
	BlinkRapid
	ReverseVideo
	Concealed
	CrossedOut
)

Base attributes

const (
	FgBlack Attribute = iota + 30
	FgRed
	FgGreen
	FgYellow
	FgBlue
	FgMagenta
	FgCyan
	FgWhite
)

Foreground text colors

const (
	FgHiBlack Attribute = iota + 90
	FgHiRed
	FgHiGreen
	FgHiYellow
	FgHiBlue
	FgHiMagenta
	FgHiCyan
	FgHiWhite
)

Foreground Hi-Intensity text colors

const (
	BgBlack Attribute = iota + 40
	BgRed
	BgGreen
	BgYellow
	BgBlue
	BgMagenta
	BgCyan
	BgWhite
)

Background text colors

const (
	BgHiBlack Attribute = iota + 100
	BgHiRed
	BgHiGreen
	BgHiYellow
	BgHiBlue
	BgHiMagenta
	BgHiCyan
	BgHiWhite
)

Background Hi-Intensity text colors

func (Attribute) RuntimeDoc

func (Attribute) RuntimeDoc(names ...string) ([]string, bool)

type LogLevel

type LogLevel string

+gengo:enum

const (
	ErrorLevel LogLevel = "error"
	WarnLevel  LogLevel = "warn"
	InfoLevel  LogLevel = "info"
	DebugLevel LogLevel = "debug"
)

func (LogLevel) EnumValues

func (LogLevel) EnumValues() []any

func (LogLevel) RuntimeDoc

func (LogLevel) RuntimeDoc(names ...string) ([]string, bool)

type Logger

type Logger struct {
	// Log level
	LogLevel LogLevel `flag:",omitempty"`
	// contains filtered or unexported fields
}

func (*Logger) Init

func (o *Logger) Init(ctx context.Context) error

func (*Logger) InjectContext

func (o *Logger) InjectContext(ctx context.Context) context.Context

func (Logger) RuntimeDoc

func (v Logger) RuntimeDoc(names ...string) ([]string, bool)

func (*Logger) SetDefaults

func (o *Logger) SetDefaults()

type Printer

type Printer interface {
	Fprintf(w io.Writer, format string, a ...any) (n int, err error)
}

type WrapWriter

type WrapWriter = func(w io.Writer) io.Writer

Jump to

Keyboard shortcuts

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