logger

package
v0.1.0-18-g5afcef2 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2022 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoggerTypeToString

func LoggerTypeToString(t LoggerType) string

Types

type LogLevel

type LogLevel uint

LogLevel controls what log statements are activated for a given logger

const (
	FATAL LogLevel = iota
	ERROR
	WARN
	INFO
	DEBUG
	TRACE
)

Log levels

func LogLevelFromString

func LogLevelFromString(name string) LogLevel

func (LogLevel) String

func (ll LogLevel) String() string

String returns the canonical name of the level

type Logger

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

Logger maintains a set of logging functions and has a log level that can be modified dynamically

func NewLogger

func NewLogger(out io.Writer, cs *iostreams.ColorScheme) *Logger

NewLogger creates a new logger Default level is INFO

func (*Logger) Clone

func (l *Logger) Clone() log.Logger

func (*Logger) Debug

func (l *Logger) Debug(a ...interface{})

func (*Logger) Debugf

func (l *Logger) Debugf(format string, a ...interface{})

func (*Logger) Error

func (l *Logger) Error(a ...interface{})

func (*Logger) Errorf

func (l *Logger) Errorf(format string, a ...interface{})

func (*Logger) Fatal

func (l *Logger) Fatal(a ...interface{})

func (*Logger) Fatalf

func (l *Logger) Fatalf(format string, a ...interface{})

func (*Logger) Info

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

func (*Logger) Infof

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

func (*Logger) Level

func (l *Logger) Level() string

func (*Logger) Output

func (l *Logger) Output() io.Writer

func (*Logger) SetLevel

func (l *Logger) SetLevel(level LogLevel)

SetLevel updates the logging level for future logs

func (*Logger) SetOutput

func (l *Logger) SetOutput(w io.Writer)

func (*Logger) Trace

func (l *Logger) Trace(a ...interface{})

func (*Logger) Tracef

func (l *Logger) Tracef(format string, a ...interface{})

func (*Logger) Warn

func (l *Logger) Warn(a ...interface{})

func (*Logger) Warnf

func (l *Logger) Warnf(format string, a ...interface{})

func (*Logger) Warning

func (l *Logger) Warning(a ...interface{})

func (*Logger) Warningf

func (l *Logger) Warningf(format string, a ...interface{})

type LoggerType

type LoggerType uint

LoggerType controls how log statements are output

const (
	QUIET LoggerType = iota
	BASIC
	FANCY
	JSON
)

Logger types

func LoggerTypeFromString

func LoggerTypeFromString(name string) LoggerType

Jump to

Keyboard shortcuts

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