log

package
v0.73.2 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2022 License: Apache-2.0 Imports: 6 Imported by: 2

Documentation

Overview

Package log provides logging abstractions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Debug

func Debug(args ...interface{})

Debug logging.

func Debugf

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

Debugf logging.

func Enabled added in v0.31.0

func Enabled(l Level) bool

Enabled shows if the logger logs for the given level.

func Error

func Error(args ...interface{})

Error logging.

func Errorf

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

Errorf logging.

func Fatal

func Fatal(args ...interface{})

Fatal logging.

func Fatalf

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

Fatalf logging.

func IncreaseDebugCounter added in v0.71.0

func IncreaseDebugCounter()

IncreaseDebugCounter increases the debug counter.

func IncreaseErrorCounter added in v0.71.0

func IncreaseErrorCounter()

IncreaseErrorCounter increases the error counter.

func IncreaseFatalCounter added in v0.71.0

func IncreaseFatalCounter()

IncreaseFatalCounter increases the fatal counter.

func IncreaseInfoCounter added in v0.71.0

func IncreaseInfoCounter()

IncreaseInfoCounter increases the info counter.

func IncreasePanicCounter added in v0.71.0

func IncreasePanicCounter()

IncreasePanicCounter increases the panic counter.

func IncreaseWarnCounter added in v0.71.0

func IncreaseWarnCounter()

IncreaseWarnCounter increases the warn counter.

func Info

func Info(args ...interface{})

Info logging.

func Infof

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

Infof logging.

func LevelCount added in v0.71.0

func LevelCount(level string) prometheus.Counter

LevelCount returns the total level count.

func LevelOrder added in v0.46.0

func LevelOrder(lvl Level) int

LevelOrder returns the numerical order of the level.

func Panic

func Panic(args ...interface{})

Panic logging.

func Panicf

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

Panicf logging.

func ResetLogCounter added in v0.71.0

func ResetLogCounter()

ResetLogCounter resets the log counter.

func Setup

func Setup(l Logger) error

Setup logging by providing a logger factory.

func Warn

func Warn(args ...interface{})

Warn logging.

func Warnf

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

Warnf logging.

func WithContext added in v0.23.0

func WithContext(ctx context.Context, l Logger) context.Context

WithContext associates a logger with a context for later reuse.

Types

type Level

type Level string

The Level type definition.

const (
	// DebugLevel level.
	DebugLevel Level = "debug"
	// InfoLevel level.
	InfoLevel Level = "info"
	// WarnLevel level.
	WarnLevel Level = "warn"
	// ErrorLevel level.
	ErrorLevel Level = "error"
	// FatalLevel level.
	FatalLevel Level = "fatal"
	// PanicLevel level.
	PanicLevel Level = "panic"
	// NoLevel level.
	NoLevel Level = ""
)

type Logger

type Logger interface {
	Sub(map[string]interface{}) Logger
	Fatal(...interface{})
	Fatalf(string, ...interface{})
	Panic(...interface{})
	Panicf(string, ...interface{})
	Error(...interface{})
	Errorf(string, ...interface{})
	Warn(...interface{})
	Warnf(string, ...interface{})
	Info(...interface{})
	Infof(string, ...interface{})
	Debug(...interface{})
	Debugf(string, ...interface{})
	Level() Level
}

Logger interface definition of a logger.

func FromContext added in v0.23.0

func FromContext(ctx context.Context) Logger

FromContext returns the logger in the context or a nil logger.

func Sub

func Sub(ff map[string]interface{}) Logger

Sub returns a sub logger with new fields attached.

Directories

Path Synopsis
Package std is the implementation of the logger interface with the standard log package.
Package std is the implementation of the logger interface with the standard log package.
Package zerolog is a concrete implementation of the log abstractions.
Package zerolog is a concrete implementation of the log abstractions.

Jump to

Keyboard shortcuts

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