log

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2019 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FileLogger

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

FileLogger logs the provided messages at level or below to the writer, or delegates to klog.

func (*FileLogger) Error

func (f *FileLogger) Error(args ...interface{})

Error records an error log entry.

func (*FileLogger) Errorf

func (f *FileLogger) Errorf(format string, args ...interface{})

Errorf records an error log entry.

func (*FileLogger) Fatal

func (f *FileLogger) Fatal(args ...interface{})

Fatal records a fatal log entry and terminates the program.

func (*FileLogger) Fatalf

func (f *FileLogger) Fatalf(format string, args ...interface{})

Fatalf records a fatal log entry and terminates the program.

func (*FileLogger) Info

func (f *FileLogger) Info(args ...interface{})

Info records an info log entry.

func (*FileLogger) Infof

func (f *FileLogger) Infof(format string, args ...interface{})

Infof records an info log entry.

func (*FileLogger) Is

func (f *FileLogger) Is(level int32) bool

Is returns whether the current logging level is greater than or equal to the parameter.

func (*FileLogger) V

func (f *FileLogger) V(level int32) VerboseLogger

V will returns a logger which will discard output if the specified level is greater than the current logging level.

func (*FileLogger) Warning

func (f *FileLogger) Warning(args ...interface{})

Warning records an warning log entry.

func (*FileLogger) Warningf

func (f *FileLogger) Warningf(format string, args ...interface{})

Warningf records an warning log entry.

type Logger

type Logger interface {
	Is(level int32) bool
	V(level int32) VerboseLogger
	Infof(format string, args ...interface{})
	Info(args ...interface{})
	Warningf(format string, args ...interface{})
	Warning(args ...interface{})
	Errorf(format string, args ...interface{})
	Error(args ...interface{})
	Fatalf(format string, args ...interface{})
	Fatal(args ...interface{})
}

Logger is a simple interface that is roughly equivalent to klog.

var (
	// None implements the Logger interface but does nothing with the log output.
	None Logger = discard{}
	// StderrLog implements the Logger interface for stderr.
	StderrLog = ToFile(os.Stderr, 2)
)

func ToFile

func ToFile(x io.Writer, level int32) Logger

ToFile creates a logger that will log any items at level or below to file, and defer any other output to klog (no matter what the level is).

type VerboseLogger

type VerboseLogger interface {
	Infof(format string, args ...interface{})
	Info(args ...interface{})
}

VerboseLogger is roughly equivalent to klog's Verbose.

Jump to

Keyboard shortcuts

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