output

package
v5.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Fail = func(err error) {
	_, _ = fmt.Fprintf(IoStreams.ErrOut, "%s\n", err.Error())
	os.Exit(1)
}
View Source
var Failf = func(msg string, args ...interface{}) {
	_, _ = fmt.Fprintf(IoStreams.ErrOut, msg+"\n", args...)
	os.Exit(1)
}
View Source
var IoStreams = DefaultIOStreams()

Functions

func CreateLogger

func CreateLogger(out io.Writer, prefix string) *log.Logger

func CreateVerboseLogger

func CreateVerboseLogger(prefix string, verbose bool) *log.Logger

func Debugf

func Debugf(msg string, args ...interface{})

func Infof

func Infof(msg string, args ...interface{})

func PrintObject

func PrintObject(object interface{}, format string) error

func PrintStrings

func PrintStrings(args ...string)

func Statusf

func Statusf(msg string, args ...interface{})

func TestLogf

func TestLogf(msg string, args ...interface{})

func Warnf

func Warnf(msg string, args ...interface{})

Types

type IOStreams

type IOStreams struct {
	In       io.Reader
	Out      io.Writer
	ErrOut   io.Writer
	DebugOut io.Writer
}

func DefaultIOStreams

func DefaultIOStreams() IOStreams

func NewTestIOStreams

func NewTestIOStreams(debug *os.File) IOStreams

func NewTestIOStreamsWithStdIn

func NewTestIOStreamsWithStdIn(in *os.File, debug *os.File) IOStreams

func (*IOStreams) EnableDebug

func (streams *IOStreams) EnableDebug()

type StdLogger

type StdLogger interface {
	Print(v ...interface{})
	Printf(format string, v ...interface{})
	Println(v ...interface{})
}

StdLogger is used to log error messages.

var DebugLogger StdLogger = CreateLogger(io.Discard, "kafkactl")
var TestLogger StdLogger = CreateLogger(io.Discard, "test")

type TableWriter

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

func CreateTableWriter

func CreateTableWriter() TableWriter

func (*TableWriter) Flush

func (writer *TableWriter) Flush() error

func (*TableWriter) Initialize

func (writer *TableWriter) Initialize()

func (*TableWriter) Write

func (writer *TableWriter) Write(columns ...string) error

func (*TableWriter) WriteHeader

func (writer *TableWriter) WriteHeader(columns ...string) error

Jump to

Keyboard shortcuts

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