log

package
v1.6.20 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2018 License: MIT Imports: 8 Imported by: 85

Documentation

Overview

Standard logging package, batteries included.

Index

Constants

This section is empty.

Variables

View Source
var MaxStackTraceDepth = 32
View Source
var ModuleName = ``

Functions

func AppendError

func AppendError(base error, err error) error

Appends one error to another, allowing for operations that return multiple errors to remain compatible within a single-valued context.

func Confirm

func Confirm(prompt string) bool

func Confirmf

func Confirmf(format string, args ...interface{}) bool

Present a confirmation prompt. The function returns true if the user interactively responds with "yes" or "y". Otherwise the function returns false.

func Critical

func Critical(args ...interface{})

func Criticalf

func Criticalf(format string, args ...interface{})

func Debug

func Debug(args ...interface{})

func DebugStack added in v1.5.50

func DebugStack()

Logs the current stack trace as debug log output.

func Debugf

func Debugf(format string, args ...interface{})

func Debugging

func Debugging() bool

func Dump

func Dump(args ...interface{})

func Dumpf

func Dumpf(format string, args ...interface{})

func Error

func Error(args ...interface{})

func Errorf

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

func Fatal

func Fatal(args ...interface{})

func Fatalf

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

func Info

func Info(args ...interface{})

func Infof

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

func Log

func Log(level Level, args ...interface{})

func Logf

func Logf(level Level, format string, args ...interface{})

func Logger

func Logger() *logging.Logger

func Notice

func Notice(args ...interface{})

func Noticef

func Noticef(format string, args ...interface{})

func Panic

func Panic(args ...interface{})

func Panicf

func Panicf(format string, args ...interface{})

func SetLevel

func SetLevel(level Level, modules ...string)

func SetLevelString

func SetLevelString(level string, modules ...string)

func SetOutput

func SetOutput(w io.Writer)

Set the destination Writer where logs will henceforth be written.

func Warning

func Warning(args ...interface{})

func Warningf

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

Types

type FormattedLogFunc

type FormattedLogFunc func(format string, args ...interface{})

type Level

type Level int
const (
	PANIC Level = iota
	FATAL
	CRITICAL
	ERROR
	WARNING
	NOTICE
	INFO
	DEBUG
)
var LogLevel Level = func() Level {
	if v := os.Getenv(`LOGLEVEL`); v != `` {
		return GetLevel(v)
	} else {
		return INFO
	}
}()

The LOGLEVEL environment variable has final say over the effective log level for all users of this package.

func GetLevel

func GetLevel(level string) Level

func (Level) String

func (self Level) String() string

type LogFunc

type LogFunc func(args ...interface{})

type LogParseFunc

type LogParseFunc func(line string) (Level, string)

type StackItem added in v1.5.50

type StackItem struct {
	ProgramCounter uintptr
	Filename       string
	Line           int
	Function       string
}

func (StackItem) String added in v1.5.50

func (self StackItem) String() string

type StackItems added in v1.5.50

type StackItems []StackItem

func StackTrace added in v1.5.50

func StackTrace(skip int) StackItems

Retrieves details about the call stack that led to this function call.

type WritableLogger

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

func NewWritableLogger

func NewWritableLogger(level Level, prefix ...string) *WritableLogger

func (*WritableLogger) SetParserFunc

func (self *WritableLogger) SetParserFunc(fn LogParseFunc) *WritableLogger

func (*WritableLogger) Write

func (self *WritableLogger) Write(p []byte) (int, error)

Jump to

Keyboard shortcuts

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