logging

package
v0.0.0-...-d8c7374 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2017 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var SystemLogger destination

The default logger

Functions

func Debugf

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

Debugf to log message at info level.

func Errorf

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

Errorf to log message and warning messages will be logged.

func Fatalf

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

Fatalf to log message and warning messages will be logged.

func Infof

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

Infof to log message at info level.

func IsEnabled

func IsEnabled(lvl LogLevel) bool

Check if logging is enabled

func LazyDebug

func LazyDebug(fn func() string)

Run function only if output will be logged at debug level

func LazyDebugf

func LazyDebugf(fmt string, fns ...func() string)

Run function only if output will be logged at debug level Only %v is allowable in format string

func LazyTrace

func LazyTrace(fn func() string)

Run function only if output will be logged at trace level

func LazyTracef

func LazyTracef(fmt string, fns ...func() string)

Run function only if output will be logged at trace level Only %v is allowable in format string

func LazyVerbose

func LazyVerbose(fn func() string)

Run function only if output will be logged at verbose level

func LazyVerbosef

func LazyVerbosef(fmt string, fns ...func() string)

Run function only if output will be logged at verbose level Only %v is allowable in format string

func PeriodicProfile

func PeriodicProfile(level LogLevel, port string, endpoints ...string)

Dump profiling info periodically

func Profile

func Profile(port string, endpoints ...string) string

Get profiling info

func SetLogLevel

func SetLogLevel(to LogLevel)

Set the base log level

func SetLogWriter

func SetLogWriter(w io.Writer)

SetLogWriter sets a new default destination

func StackTrace

func StackTrace() string

StackTrace prints current stack at specified log level

func Tracef

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

Tracef to log message at info level.

func Verbosef

func Verbosef(format string, v ...interface{})

Verbosef to log message at verbose level.

func Warnf

func Warnf(format string, v ...interface{})

A set of convenience methods to log to default logger See correspond methods on destination for details

Types

type Ender

type Ender interface {
	// Stop and log timing
	End()
}

Timer interface

type LogLevel

type LogLevel int16

Log levels

const (
	Silent LogLevel = iota
	Fatal
	Error
	Warn
	Info
	Verbose
	Timing
	Debug
	Trace
)

func Level

func Level(s string) LogLevel

func (LogLevel) String

func (t LogLevel) String() string

Messages administrator should eventually see.

type Logger

type Logger interface {
	// Warnings, logged by default.
	Warnf(format string, v ...interface{})
	// Errors, logged by default.
	Errorf(format string, v ...interface{})
	// Fatal errors. Will not terminate execution.
	Fatalf(format string, v ...interface{})
	// Informational messages.
	Infof(format string, v ...interface{})
	// Verbose messages like request logging
	Verbosef(format string, v ...interface{})
	// Get stack trace
	StackTrace() string
	// Timing utility
	Timer(format string, v ...interface{}) Ender
	// Debugging messages
	Debugf(format string, v ...interface{})
	// Program execution
	Tracef(format string, v ...interface{})
	// Call and print the stringer if verbose enabled
	LazyVerbose(fn func() string)
	// Call and print the stringer if debugging enabled
	LazyDebug(fn func() string)
	// Call and print the stringer if tracing enabled
	LazyTrace(fn func() string)
}

Logger interface

Jump to

Keyboard shortcuts

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