Help us shape the future of Go! Take the 2026 Go Developer Survey

logging

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type JSONPrinter

type JSONPrinter struct {
	Out    io.Writer
	Silent bool
}

func NewJSONPrinter

func NewJSONPrinter(silent bool) *JSONPrinter

func (*JSONPrinter) Print

func (self *JSONPrinter) Print(kind Kind, msg string)

func (*JSONPrinter) PrintStructured

func (self *JSONPrinter) PrintStructured(data any)

PrintStructured outputs arbitrary structured data as formatted JSON. This is used for outputting test results and other structured data, not log messages. Respects the Silent flag.

func (*JSONPrinter) Println

func (self *JSONPrinter) Println(kind Kind, msg string)

type Kind

type Kind uint8
const (
	Info Kind = iota
	Success
	Warn
	Error
	Debug
)

type NullPrinter

type NullPrinter struct{}

func (NullPrinter) Print

func (NullPrinter) Print(Kind, string)

func (NullPrinter) Println

func (NullPrinter) Println(Kind, string)

func (NullPrinter) Styled

func (NullPrinter) Styled(Kind, Style, string, bool)

type Printer

type Printer interface {
	Print(Kind, string)
	Println(Kind, string)
	Styled(Kind, Style, string, bool)
}

type Style

type Style uint8
const (
	Normal Style = iota
	Emphasis
	Green
	Red
	Grey
)

type TextPrinter

type TextPrinter struct {
	Out    io.Writer
	Err    io.Writer
	Silent bool
	Color  bool
}

func NewPrinter

func NewPrinter() *TextPrinter

func (*TextPrinter) Print

func (self *TextPrinter) Print(kind Kind, msg string)

func (*TextPrinter) Println

func (self *TextPrinter) Println(kind Kind, msg string)

func (*TextPrinter) Styled

func (self *TextPrinter) Styled(kind Kind, style Style, msg string, newline bool)

Jump to

Keyboard shortcuts

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