log

package
v0.0.0-...-f99419a Latest Latest
Warning

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

Go to latest
Published: May 4, 2021 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DebugLevel logs a lot, and should be disabled in production.
	DebugLevel = "debug"
	// InfoLevel is the default logging priority.
	InfoLevel = "info"
	// WarnLevel logs are more important than Info, but don't need user attention right away.
	WarnLevel = "warn"
	// ErrorLevel logs are high-priority.
	ErrorLevel = "error"
	// FatalLevel logs a message, then calls os.Exit(1).
	FatalLevel = "fatal"
	// PanicLevel logs a message, then panics.
	PanicLevel = "panic"
)

Variables

This section is empty.

Functions

func Debug

func Debug(args ...interface{})

Debug construct and log a message.

func Debugf

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

Debugf formats the log message according to a format.

func Error

func Error(args ...interface{})

Error construct and log a message.

func Errorf

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

Errorf formats the log message according to a format.

func Fatal

func Fatal(args ...interface{})

Fatal construct and log a message, then calls os.Exit.

func Fatalf

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

Fatalf formats the log message according to a format, then calls os.Exit.

func Flush

func Flush()

Flush flushes any buffered log entries.

func GetLogLevel

func GetLogLevel() string

func Info

func Info(args ...interface{})

Info construct and log a message.

func Infof

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

Infof formats the log message according to a format.

func LevelHandler

func LevelHandler(w http.ResponseWriter, r *http.Request)

LevelHandler is a simple JSON endpoint that can report on or change the current logging level.

GET requests return a JSON description of the current logging level. PUT requests change the logging level and expect a payload like: {"level":"info"}

func Panic

func Panic(args ...interface{})

Panic construct and log a message, then panics.

func Panicf

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

Panicf formats the log message according to a format, then panics.

func Print

func Print(args ...interface{})

Print construct and log a message.

func Printf

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

Printf formats the log message according to a format.

func Println

func Println(args ...interface{})

Println construct and log a message.

func SetLogLevel

func SetLogLevel(level string)

SetLogLevel sets the log output level.

func Warn

func Warn(args ...interface{})

Warn construct and log a message.

func Warnf

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

Warnf formats the log message according to a format.

Types

type Level

type Level string

type Logger

type Logger interface {
	GetLogLevel() string
	SetLogLevel(level string)
	Debug(args ...interface{})
	Debugf(format string, args ...interface{})
	Info(args ...interface{})
	Infof(format string, args ...interface{})
	Warn(args ...interface{})
	Warnf(format string, args ...interface{})
	Error(args ...interface{})
	Errorf(format string, args ...interface{})
	Fatal(args ...interface{})
	Fatalf(format string, args ...interface{})
	Panic(args ...interface{})
	Panicf(format string, args ...interface{})
	Print(args ...interface{})
	Printf(format string, args ...interface{})
	Println(args ...interface{}) // for prometheus
	Flush()
	Named(name string) Logger
	With(args ...interface{}) Logger
	LevelHandler(w http.ResponseWriter, r *http.Request)
}
var DefaultLogger Logger = NewZapLogger()

func Named

func Named(name string) Logger

Named adds a sub-scope to the logger's name.

func NewNoopLogger

func NewNoopLogger() Logger

func NewZapLogger

func NewZapLogger() Logger

func With

func With(args ...interface{}) Logger

With adds values to the logging context.

Jump to

Keyboard shortcuts

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