logger

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2023 License: Apache-2.0 Imports: 6 Imported by: 7

Documentation

Index

Constants

View Source
const (
	DebugLevel = Level(zerolog.DebugLevel)
	InfoLevel  = Level(zerolog.InfoLevel)
	WarnLevel  = Level(zerolog.WarnLevel)
	ErrorLevel = Level(zerolog.ErrorLevel)
	FatalLevel = Level(zerolog.FatalLevel)
	PanicLevel = Level(zerolog.PanicLevel)
)

Variables

This section is empty.

Functions

func Debug

func Debug(ctx context.Context, msg string, kvs ...interface{})

func Error

func Error(ctx context.Context, err error, msg string, kvs ...interface{})

func Fatal

func Fatal(ctx context.Context, msg string, kvs ...interface{})

func Info

func Info(ctx context.Context, msg string, kvs ...interface{})

func Panic

func Panic(ctx context.Context, msg string, kvs ...interface{})

func SetCallerEnabled

func SetCallerEnabled(enabled bool)

func SetGlobalLevel

func SetGlobalLevel(level Level)

func SetStacktraceEnabled

func SetStacktraceEnabled(enabled bool)

func ToContext

func ToContext(ctx context.Context, logger *Logger) context.Context

func Warn

func Warn(ctx context.Context, msg string, kvs ...interface{})

Types

type Level

type Level int8

func ParseLevel

func ParseLevel(levelStr string) (Level, error)

type Logger

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

func FromContext

func FromContext(ctx context.Context) *Logger

func New

func New(level Level, opts ...Option) *Logger

func (*Logger) Debug

func (l *Logger) Debug(msg string, kvs ...interface{})

func (*Logger) Error

func (l *Logger) Error(err error, msg string, kvs ...interface{})

func (*Logger) Fatal

func (l *Logger) Fatal(msg string, kvs ...interface{})

func (*Logger) Info

func (l *Logger) Info(msg string, kvs ...interface{})

func (*Logger) Level

func (l *Logger) Level(level Level) *Logger

func (*Logger) Panic

func (l *Logger) Panic(msg string, kvs ...interface{})

func (*Logger) Warn

func (l *Logger) Warn(msg string, kvs ...interface{})

func (*Logger) With

func (l *Logger) With(kvs ...interface{}) *Logger

type Option

type Option func(*Logger)

func WithPlainText

func WithPlainText() Option

func WriteToFile

func WriteToFile(f *os.File) Option

Jump to

Keyboard shortcuts

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