logging

package
v0.12.0-beta3 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2021 License: MIT Imports: 5 Imported by: 1

Documentation

Overview

Package logging provides logging facilities.

Index

Constants

This section is empty.

Variables

View Source
var RootLogger = &Logger{}

RootLogger is the root logger from which all other loggers derive.

Functions

This section is empty.

Types

type Level added in v0.11.0

type Level uint8

Level represents a logging level.

const (
	// LevelDisabled indicates that logging is completely disabled.
	LevelDisabled Level = iota
	// LevelError indicates that only fatal errors are logged.
	LevelError
	// LevelWarning indicates that both fatal and non-fatal errors are logged.
	LevelWarning
	// LevelInfo indicates that basic execution information is logged (in
	// addition to all errors).
	LevelInfo
	// LevelDebug indicates that advanced execution information is logged (in
	// addition to basic information and all errors).
	LevelDebug
	// LevelTrace indicates that low-level execution information is logged (in
	// addition to all other execution information and all errors).
	LevelTrace
)

func (Level) String added in v0.11.0

func (l Level) String() string

String provides a human-readable representation of a logging level.

type Logger

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

Logger is the main logger type. It has the novel property that it still functions if nil, but it doesn't log anything. It is designed to use the standard logger provided by the log package, so it respects any flags set for that logger. It is safe for concurrent usage.

func (*Logger) Debug

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

Debug logs debug information with formatting semantics equivalent to fmt.Println.

func (*Logger) Debugf

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

Debugf logs debug information with formatting semantics equivalent to fmt.Printf.

func (*Logger) Error

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

Error logs errors with formatting semantics equivalent to fmt.Println.

func (*Logger) Errorf added in v0.11.0

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

Errorf logs errors with formatting semantics equivalent to fmt.Printf.

func (*Logger) Info added in v0.11.0

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

Info logs information with formatting semantics equivalent to fmt.Println.

func (*Logger) Infof added in v0.11.0

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

Infof logs information with formatting semantics equivalent to fmt.Printf.

func (*Logger) Sublogger

func (l *Logger) Sublogger(name string) *Logger

Sublogger creates a new sublogger with the specified name.

func (*Logger) Trace added in v0.11.0

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

Trace logs tracing information with formatting semantics equivalent to fmt.Println.

func (*Logger) Tracef added in v0.11.0

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

Tracef logs tracing information with formatting semantics equivalent to fmt.Printf.

func (*Logger) Warning added in v0.11.0

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

Warning logs warnings with formatting semantics equivalent to fmt.Println.

func (*Logger) Warningf added in v0.11.0

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

Warningf logs warnings with formatting semantics equivalent to fmt.Printf.

func (*Logger) Writer

func (l *Logger) Writer(level Level) io.Writer

Writer returns an io.Writer that logs output lines using the specified level.

Jump to

Keyboard shortcuts

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