console

package
v0.6.6 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2024 License: Unlicense Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Logger

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

Logger is a type which may be used to write logs to a console.

func FromCtx

func FromCtx(c context.Context) *Logger

FromCtx retrieves a Logger from c.

func NewLogger

func NewLogger(w io.Writer, opts ...Opt) *Logger

NewLogger constructs a Logger to write to w.

func (*Logger) Ctx

func (l *Logger) Ctx(c context.Context) context.Context

Ctx returns a child context.Context with l set as the context's logger.

func (*Logger) Print

func (l *Logger) Print(output string) error

Print prints a line of output to the console.

func (*Logger) Printf

func (l *Logger) Printf(format string, args ...any) error

Printf prints a line of output with formatting to the console.

func (*Logger) VerbosePrint

func (l *Logger) VerbosePrint(output string) error

VerbosePrint prints a line of output _only if_ l was created with the Verbose option.

func (*Logger) VerbosePrintf

func (l *Logger) VerbosePrintf(format string, args ...any) error

VerbosePrintf is like VerbosePrint but for Printf.

func (*Logger) WithPrefix

func (l *Logger) WithPrefix(pfx string) *Logger

WithPrefix returns a new Logger with pfx added. Any existing prefix in l will be prepended.

type Opt

type Opt func(*Logger)

func Verbose

func Verbose() Opt

Jump to

Keyboard shortcuts

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