logger

package
v0.33.11 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2023 License: AGPL-3.0, AGPL-3.0-only Imports: 12 Imported by: 0

Documentation

Overview

Package logger config a zap logger, functions have same signature with `zap.logger`. Can be configured by env `LOG_LEVEL`.

Index

Constants

This section is empty.

Variables

View Source
var RequestKey = &struct{}{}

Functions

func Copy

func Copy() *zap.Logger

func Ctx added in v0.29.13

func Ctx(ctx context.Context) zap.Field

func DPanic

func DPanic(msg string, fields ...zapcore.Field)

DPanic will panic in development and log error message at production env.

func Debug

func Debug(msg string, fields ...zapcore.Field)

Debug level logging.

func Err

func Err(err error, msg string, fields ...zapcore.Field)

Err log a error message with error.

func Error

func Error(msg string, fields ...zapcore.Field)

Error level logging.

func Fatal

func Fatal(msg string, fields ...zapcore.Field)

Fatal level message and call `os.Exit(1)`.

func Info

func Info(msg string, fields ...zapcore.Field)

Info level logging.

func Infoln

func Infoln(args ...any)

Infoln log as info level with fmt.Sprintln.

func Named

func Named(name string) *zap.Logger

Named create a named logger.

func Panic

func Panic(msg string, fields ...zapcore.Field)

Panic will log at panic level then panic.

func Std

func Std() *stdLog.Logger

Std return a stdlib logger with zap logger underlying.

func StdAt added in v0.24.3

func StdAt(level zapcore.Level) *stdLog.Logger

func Warn

func Warn(msg string, fields ...zapcore.Field)

Warn level logging.

Types

type RequestTrace added in v0.29.13

type RequestTrace struct {
	IP    string
	ReqID string
}

func (*RequestTrace) MarshalLogObject added in v0.29.13

func (r *RequestTrace) MarshalLogObject(enc zapcore.ObjectEncoder) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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