log

package
v1.5.45 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2018 License: MIT Imports: 7 Imported by: 85

Documentation

Overview

Standard logging package, batteries included.

Index

Constants

This section is empty.

Variables

View Source
var ModuleName = ``

Functions

func AppendError

func AppendError(base error, err error) error

Appends on 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

func Critical

func Critical(args ...interface{})

func Criticalf

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

func Debug

func Debug(args ...interface{})

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 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