logger

package
v0.1.1491 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2018 License: MIT 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 wraps a few log.Logger instances in private fields. They are accessible via their respective methods.

func NewLogger

func NewLogger(verbose bool) *Logger

NewLogger returns a reference to a Logger. We usually call this when initializing cmd.Logger. Later we pass this to client.NewClient so it can also log. By default debug and error go to os.Stderr, and info goes to os.Stdout

func (*Logger) Debug

func (l *Logger) Debug(format string, args ...interface{})

Debug prints a formatted message to stderr only if verbose is set. Consider these messages useful for developers of the CLI. This method wraps log.Logger.Printf

func (*Logger) Error

func (l *Logger) Error(msg string, err error)

Error prints a message and the given error's message to os.Stderr This method wraps log.Logger.Print

func (*Logger) Info

func (l *Logger) Info(args ...interface{})

Info prints all args to os.Stdout It's commonly used for messages we want to show the user. This method wraps log.Logger.Print

func (*Logger) Infof

func (l *Logger) Infof(format string, args ...interface{})

Infof prints a formatted message to stdout This method wraps log.Logger.Printf

func (*Logger) Infoln

func (l *Logger) Infoln(args ...interface{})

Infoln prints all args to os.Stdout followed by a newline. This method wraps log.Logger.Println

func (*Logger) Prettyify

func (l *Logger) Prettyify(data interface{})

Prettyify accepts a map of data and pretty prints it. It's using json.MarshalIndent and printing with log.Logger.Infoln

Jump to

Keyboard shortcuts

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