printer

package
v0.0.0-...-24ca9bf Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NewLine    = "\n"         // Newline
	DbColor    = "\033[1;31m" // ANSI dbecho code
	ResetColor = "\033[0m"    // ANSI reset code
)

Variables

This section is empty.

Functions

This section is empty.

Types

type DbPrinter

type DbPrinter interface {
	DbPrintf(format string, args ...interface{}) (int, error)
	DbPrint(args ...interface{}) (int, error)
	DbPrintln(args ...interface{}) (int, error)
}

type Fprinter

type Fprinter interface {
	Fprintf(w io.Writer, format string, args ...interface{}) (int, error)
	Fprint(w io.Writer, args ...interface{}) (int, error)
	Fprintln(w io.Writer, args ...interface{}) (int, error)
}

type NormalPrinter

type NormalPrinter interface {
	Printf(format string, args ...interface{}) (int, error)
	Print(args ...interface{}) (int, error)
	Println(args ...interface{}) (int, error)
}

type Printer

type Printer interface {
	NormalPrinter
	Fprinter
	Sprinter
	DbPrinter
	SetWriter(w io.Writer)
	SetDbWriter(w io.Writer)
	SetPrefix(prefix []byte)
	SetSuffix(suffix []byte)
}

Printer implements common printer functionality. It provides Print, Println, and Printf to os.Stdout as well as the more general FPrint, etc methods for writing to a specified io.Writer. In addition, the standard Sprint methods are available.

For convenience, a DbPrinter is provided through the methods DbPrint, DbPrintln, and DbPrintf. These 'debug' printer functions print to os.Stderr by default and wrap the output in given ANSI codes.

func NewPrinter

func NewPrinter() Printer

func NewPrinterWithOptions

func NewPrinterWithOptions(w io.Writer, db io.Writer, prefix, dbColor, suffix []byte) Printer

type Sprinter

type Sprinter interface {
	Sprintf(format string, args ...interface{}) string
	Sprint(args ...interface{}) string
	Sprintln(args ...interface{}) string
}

Jump to

Keyboard shortcuts

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