log

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LevelDebug   = zap.DebugLevel
	LevelInfo    = zap.InfoLevel
	LevelWarning = zap.WarnLevel
	LevelError   = zap.ErrorLevel
	LevelStack   = zap.DPanicLevel
	LevelDump    = zap.PanicLevel
	LevelFatal   = zap.FatalLevel
)

levels

Variables

View Source
var (
	OutputType = "all"
	LogPath    = "./log"
	LogSize    = 100
	LogLevel   = LevelDebug
	Encoder    = "console"
)

Functions

func Any

func Any(key string, value any) zap.Field

func Bool

func Bool(key string, v bool) zap.Field

func Close

func Close()

func Debug

func Debug(msg string, args ...zap.Field)

func Dump

func Dump(dump string, args ...zap.Field)

func Duration

func Duration(key string, v time.Duration) zap.Field

func Error

func Error(msg string, args ...zap.Field)

func ErrorAttr

func ErrorAttr(key string, value error) zap.Field

func Fatal

func Fatal(msg string, args ...zap.Field)

func Float64

func Float64(key string, v float64) zap.Field

func Info

func Info(msg string, args ...zap.Field)

func Int

func Int(key string, value int) zap.Field

func Int16

func Int16(key string, value int16) zap.Field

func Int32

func Int32(key string, value int32) zap.Field

func Int64

func Int64(key string, value int64) zap.Field

func Int8

func Int8(key string, value int8) zap.Field

func SetHookDefer

func SetHookDefer(f func(entry zapcore.Entry) error)

SetHookDefer 设置日志defer hook 需要在node.Start()之前设置

func SetLogger

func SetLogger(logger ILogger)

SetLogger It's non-thread-safe

func Stack

func Stack(msg string, args string)

func String

func String(key, value string) zap.Field

func Time

func Time(key string, v time.Time) zap.Field

func Uint

func Uint(key string, value uint) zap.Field

func Uint16

func Uint16(key string, value uint16) zap.Field

func Uint32

func Uint32(key string, value uint32) zap.Field

func Uint64

func Uint64(key string, v uint64) zap.Field

func Uint8

func Uint8(key string, value uint8) zap.Field

func Warning

func Warning(msg string, args ...zap.Field)

Types

type ILogger

type ILogger interface {
	Debug(msg string, args ...zap.Field)
	Info(msg string, args ...zap.Field)
	Warning(msg string, args ...zap.Field)
	Error(msg string, args ...zap.Field)
	Dump(msg string, args ...zap.Field)
	Fatal(msg string, args ...zap.Field)

	Close()
	SetHook(f func(entry zapcore.Entry) error)
}

func NewLogger

func NewLogger(nodeid string) (ILogger, error)

type Logger

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

func (*Logger) Close

func (logger *Logger) Close()

Close It's dangerous to call the method on logging

func (*Logger) Debug

func (logger *Logger) Debug(msg string, args ...zap.Field)

func (*Logger) Dump

func (logger *Logger) Dump(msg string, args ...zap.Field)

func (*Logger) Error

func (logger *Logger) Error(msg string, args ...zap.Field)

func (*Logger) Fatal

func (logger *Logger) Fatal(msg string, args ...zap.Field)

func (*Logger) Info

func (logger *Logger) Info(msg string, args ...zap.Field)

func (*Logger) SetHook

func (logger *Logger) SetHook(f func(entry zapcore.Entry) error)

func (*Logger) Warning

func (logger *Logger) Warning(msg string, args ...zap.Field)

Jump to

Keyboard shortcuts

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