log

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2023 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoggerMiddleware

func LoggerMiddleware(log Logger) func(next http.Handler) http.Handler

Types

type Field

type Field interface {
	Field(key string, value interface{}) Field
	Log(message string)
	Logf(format string, args ...interface{})
}

type Logger

type Logger interface {
	Trace() Field
	Debug() Field
	Info() Field
	Warn() Field
	Error(error) Field
	Panic(error) Field
}

type Zerolog

type Zerolog struct {
	// contains filtered or unexported fields
}

func NewZerlog

func NewZerlog(options ...ZerologOption) *Zerolog

NewZerlog initializes a console logger. Additional options can be passed to the logger by specifying an option function.

func NewZerologWithWriter

func NewZerologWithWriter(writer io.Writer, options ...ZerologOption) *Zerolog

NewZerologWithWriter initializes a logger with a writer. Additional options can be passed to the logger by specifying an option function.

func (*Zerolog) Debug

func (z *Zerolog) Debug() Field

Debug adds a debug log to the message.

func (*Zerolog) Error

func (z *Zerolog) Error(err error) Field

Error adds a error log to the message.

func (*Zerolog) Info

func (z *Zerolog) Info() Field

Info adds a info log to the message.

func (*Zerolog) Panic

func (z *Zerolog) Panic(err error) Field

Panic adds a panic log to the message.

func (*Zerolog) SetLevel

func (z *Zerolog) SetLevel(level int8) Logger

SetLevel sets the log level.

func (*Zerolog) Trace

func (z *Zerolog) Trace() Field

Trace adds a trace log to the message.

func (*Zerolog) Warn

func (z *Zerolog) Warn() Field

Warn adds a warn log to the message.

type ZerologOption

type ZerologOption func(*zerolog.Logger)

Jump to

Keyboard shortcuts

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