log

package
v0.7.3 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddRequestFields added in v0.7.1

func AddRequestFields(r *http.Request, keyvals ...interface{})

AddRequestFields adds the list of key-value pairs to the request context

func Debug

func Debug() *zerolog.Event

Debug starts a new log-event with the 'debug'-level

func Error

func Error() *zerolog.Event

Error starts a new log-event with the 'error'-level

func Fatal

func Fatal() *zerolog.Event

Fatal starts a new log-event with the 'fatal'-level

func FromCtx

func FromCtx(ctx context.Context) *zerolog.Logger

FromCtx returns the logger from the context

func Info

func Info() *zerolog.Event

Info starts a new log-event with the 'info'-level

func Logger added in v0.4.0

func Logger() zerolog.Logger

Logger returns a Logger-object

func NewHandler

func NewHandler() func(http.Handler) http.Handler

NewHandler assigns the log to the context of each request

func Panic

func Panic() *zerolog.Event

Panic starts a new log-event with the 'panic'-level

func Trace

func Trace() *zerolog.Event

Trace starts a new log-event with the 'trace'-level

func Warn

func Warn() *zerolog.Event

Warn starts a new log-event with the 'warn'-level

func WithContext added in v0.3.0

func WithContext(ctx context.Context) context.Context

WithContext adds the default logger to the specified context

func WithLevel added in v0.4.2

func WithLevel(l Level)

WithLevel sets the log-level for the default logger

Types

type Level added in v0.4.2

type Level int8

Level is a type for log-levels

const (
	TraceLevel Level = 8
	DebugLevel Level = 7
	InfoLevel  Level = 6
	// Notice = 5 -- not implemented here
	WarnLevel  Level = 4
	ErrorLevel Level = 3
	// Critical = 2 -- not implemented here
	PanicLevel Level = 1
	FatalLevel Level = 0
)

Level-values are matched with 'syslog'

Jump to

Keyboard shortcuts

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