logger

package
v0.0.0-...-59dc93e Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultLevel the default log level
	DefaultLevel = zapcore.InfoLevel

	// DefaultTimeLayout the default time layout;
	DefaultTimeLayout = "2006-01-02 15:04:05.000"
)

Variables

View Source
var (
	Any         = zap.Any
	Array       = zap.Array
	Object      = zap.Object
	Binary      = zap.Binary
	Bool        = zap.Bool
	Bools       = zap.Bools
	ByteString  = zap.ByteString
	ByteStrings = zap.ByteStrings
	Complex64   = zap.Complex64
	Complex64s  = zap.Complex64s
	Complex128  = zap.Complex128
	Complex128s = zap.Complex128s
	Duration    = zap.Duration
	Durations   = zap.Durations
	Err         = zap.Error
	Errors      = zap.Errors
	Float32     = zap.Float32
	Float32s    = zap.Float32s
	Float64     = zap.Float64
	Float64s    = zap.Float64s
	Int         = zap.Int
	Ints        = zap.Ints
	Int8        = zap.Int8
	Int8s       = zap.Int8s
	Int16       = zap.Int16
	Int16s      = zap.Int16s
	Int32       = zap.Int32
	Int32s      = zap.Int32s
	Int64       = zap.Int64
	Int64s      = zap.Int64s
	Namespace   = zap.Namespace
	Reflect     = zap.Reflect
	Stack       = zap.Stack
	String      = zap.String
	Stringer    = zap.Stringer
	Strings     = zap.Strings
	Time        = zap.Time
	Times       = zap.Times
	Uint        = zap.Uint
	Uints       = zap.Uints
	Uint8       = zap.Uint8
	Uint8s      = zap.Uint8s
	Uint16      = zap.Uint16
	Uint16s     = zap.Uint16s
	Uint32      = zap.Uint32
	Uint32s     = zap.Uint32s
	Uint64      = zap.Uint64
	Uint64s     = zap.Uint64s
	Uintptr     = zap.Uintptr
	Uintptrs    = zap.Uintptrs
)

Alias for zap type functions.

Functions

func Debug

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

func Debugf

func Debugf(format string, args ...any)

func Error

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

func Errorf

func Errorf(format string, args ...any)

func Fatal

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

func Fatalf

func Fatalf(format string, args ...any)

func Info

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

func Infof

func Infof(format string, args ...any)

func New

func New(opts ...Option)

func NewDevelopment

func NewDevelopment(opts ...Option)

func SetLevel

func SetLevel(lv string)

func SugaredLogger

func SugaredLogger() *zap.SugaredLogger

func Warn

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

func Warnf

func Warnf(format string, args ...any)

Types

type Field

type Field = zapcore.Field

Field is an alias for the field structure in the underlying log frame.

type Logger

type Logger interface {
	Debug(msg string, fields ...Field)
	Info(msg string, fields ...Field)
	Warn(msg string, fields ...Field)
	Error(msg string, fields ...Field)
	Fatal(msg string, fields ...Field)

	Debugf(format string, args ...any)
	Infof(format string, args ...any)
	Warnf(format string, args ...any)
	Errorf(format string, args ...any)
	Fatalf(format string, args ...any)
}

func WithFields

func WithFields(fs ...Field) Logger

type Option

type Option func(*option)

Option custom setup config

func AddCallerSkip

func AddCallerSkip(skip int) Option

func WithCaller

func WithCaller(enabled bool) Option

func WithDisableConsole

func WithDisableConsole() Option

WithDisableConsole WithEnableConsole write log to os.Stdout or os.Stderr

func WithEncode

func WithEncode(encode string) Option

func WithFileP

func WithFileP(file string) Option

WithFileP write log to some file

func WithFileRotationP

func WithFileRotationP(file string) Option

WithFileRotationP write log to some file with rotation

func WithLevel

func WithLevel(level string) Option

WithLevel only greater than 'level' will output

func WithTimeLayout

func WithTimeLayout(timeLayout string) Option

WithTimeLayout custom time format

Jump to

Keyboard shortcuts

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