tlog

package
v1.0.7 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	// VerbosityError shows only error messages
	VerbosityError = Verbosity(iota)
	// VerbosityWarning shows error and warning messages
	VerbosityWarning = Verbosity(iota)
	// VerbosityNote shows error, warning and note messages
	VerbosityNote = Verbosity(iota)
	// VerbosityDebug shows all messages
	VerbosityDebug = Verbosity(iota)
)

Variables

View Source
var (
	// Error is a predefined log channel for errors. This log is backed by consumer.Log
	Error = log.New(logDisabled, "", log.Lshortfile)

	// Warning is a predefined log channel for warnings. This log is backed by consumer.Log
	Warning = log.New(logDisabled, "", 0)

	// Note is a predefined log channel for notes. This log is backed by consumer.Log
	Note = log.New(logDisabled, "", 0)

	// Debug is a predefined log channel for debug messages. This log is backed by consumer.Log
	Debug = log.New(logDisabled, "", 0)
)

Functions

func SetCacheWriter

func SetCacheWriter()

SetCacheWriter will force all logs to be cached until another writer is set

func SetVerbosity

func SetVerbosity(loglevel Verbosity)

SetVerbosity defines the type of messages to be processed. High level verobosities contain lower levels, i.e. log level warning will contain error messages, too.

func SetWriter

func SetWriter(writer io.Writer)

SetWriter forces (enabled) logs to be written to the given writer.

Types

type LogScope

type LogScope struct {
	Error   *log.Logger
	Warning *log.Logger
	Note    *log.Logger
	Debug   *log.Logger
	// contains filtered or unexported fields
}

LogScope allows to wrap the standard Error, Warning, Note and Debug loggers into a scope, i.e. all messages written to this logger are prefixed.

func NewLogScope

func NewLogScope(name string) LogScope

NewLogScope creates a new LogScope with the given prefix string.

func (*LogScope) NewSubScope

func (scope *LogScope) NewSubScope(name string) LogScope

NewSubScope creates a log scope inside an existing log scope.

type Verbosity

type Verbosity byte

Verbosity defines an enumeration for log verbosity

Jump to

Keyboard shortcuts

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