logger

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2022 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LevelDebug = -1 + iota
	LevelInfo
	LevelWarn
	LevelError
	LevelPanic
)
View Source
const DefaultPath = "./logs"
View Source
const (
	MillTimeFormat = "2006-01-02 15:04:05.000"
)

Variables

This section is empty.

Functions

func Debug

func Debug(msg string, v ...interface{})

func DebugWithField

func DebugWithField(msg string, v ...zap.Field)

func DebugWithMap

func DebugWithMap(obj map[string]interface{}, msg string, v ...interface{})

func DebugWithStruct

func DebugWithStruct(obj interface{}, msg string, v ...interface{})

func Error

func Error(msg string, v ...interface{})

func ErrorWithField

func ErrorWithField(msg string, v ...zap.Field)

func ErrorWithMap

func ErrorWithMap(obj map[string]interface{}, msg string, v ...interface{})

func ErrorWithStruct

func ErrorWithStruct(obj interface{}, msg string, v ...interface{})

func Info

func Info(msg string, v ...interface{})

func InfoWithField

func InfoWithField(msg string, v ...zap.Field)

func InfoWithMap

func InfoWithMap(obj map[string]interface{}, msg string, v ...interface{})

func InfoWithStruct

func InfoWithStruct(obj interface{}, msg string, v ...interface{})

func InitLogger

func InitLogger(path, file string, level int)

func LDebug

func LDebug(name string, msg string, v ...interface{})

func LDebugWithField

func LDebugWithField(name string, msg string, v ...zap.Field)

func LDebugWithMap

func LDebugWithMap(name string, obj map[string]interface{}, msg string, v ...interface{})

func LDebugWithStruct

func LDebugWithStruct(name string, obj interface{}, msg string, v ...interface{})

func LError

func LError(name string, msg string, v ...interface{})

func LErrorWithField

func LErrorWithField(name string, msg string, v ...zap.Field)

func LErrorWithMap

func LErrorWithMap(name string, obj map[string]interface{}, msg string, v ...interface{})

func LErrorWithStruct

func LErrorWithStruct(name string, obj interface{}, msg string, v ...interface{})

func LInfo

func LInfo(name string, msg string, v ...interface{})

func LInfoWithField

func LInfoWithField(name string, msg string, v ...zap.Field)

func LInfoWithMap

func LInfoWithMap(name string, obj map[string]interface{}, msg string, v ...interface{})

func LInfoWithStruct

func LInfoWithStruct(name string, obj interface{}, msg string, v ...interface{})

func LPanic

func LPanic(name string, msg string, v ...interface{})

func LPanicWithField

func LPanicWithField(name string, msg string, v ...zap.Field)

func LPanicWithMap

func LPanicWithMap(name string, obj map[string]interface{}, msg string, v ...interface{})

func LPanicWithStruct

func LPanicWithStruct(name string, obj interface{}, msg string, v ...interface{})

func LWarn

func LWarn(name string, msg string, v ...interface{})

func LWarnWithField

func LWarnWithField(name string, msg string, v ...zap.Field)

func LWarnWithMap

func LWarnWithMap(name string, obj map[string]interface{}, msg string, v ...interface{})

func LWarnWithStruct

func LWarnWithStruct(name string, obj interface{}, msg string, v ...interface{})

func NormalTimeEncoder

func NormalTimeEncoder(t time.Time, enc zapcore.PrimitiveArrayEncoder)

func Painc

func Painc(e error)

func Warn

func Warn(msg string, v ...interface{})

func WarnWithField

func WarnWithField(msg string, v ...zap.Field)

func WarnWithMap

func WarnWithMap(obj map[string]interface{}, msg string, v ...interface{})

func WarnWithStruct

func WarnWithStruct(obj interface{}, msg string, v ...interface{})

Types

type LogObj

type LogObj struct {
	Key        string
	Path       string
	Name       string
	Level      int
	ShowCaller bool
	ToConsole  bool
	ZapLogger  *zap.Logger
}

func CheckLogger

func CheckLogger(name string) *LogObj

func GenLogger

func GenLogger(path string, name string, level int, showCaller bool) *LogObj

func GenLoggerWithConsole

func GenLoggerWithConsole(path string, name string, level int, showCaller bool, toConsole bool) *LogObj

type SpecLogger

type SpecLogger struct {
	Name string
}
var DBLogger *SpecLogger

DBLogger 数据库

var RequestLogger *SpecLogger

RequestLogger 所有输入与输出的日志 http,tcp,udp,serial...

var WSLogger *SpecLogger

WSLogger websocket

func NewSpecLogger

func NewSpecLogger(name string, showCaller, toConsole bool) *SpecLogger

func (SpecLogger) Debug

func (l SpecLogger) Debug(msg string, v ...interface{})

func (SpecLogger) DebugWithField

func (l SpecLogger) DebugWithField(msg string, v ...zap.Field)

func (SpecLogger) DebugWithMap

func (l SpecLogger) DebugWithMap(obj map[string]interface{}, msg string, v ...interface{})

func (SpecLogger) DebugWithStruct

func (l SpecLogger) DebugWithStruct(obj interface{}, msg string, v ...interface{})

func (SpecLogger) Error

func (l SpecLogger) Error(msg string, v ...interface{})

func (SpecLogger) ErrorWithField

func (l SpecLogger) ErrorWithField(msg string, v ...zap.Field)

func (SpecLogger) ErrorWithMap

func (l SpecLogger) ErrorWithMap(obj map[string]interface{}, msg string, v ...interface{})

func (SpecLogger) ErrorWithStruct

func (l SpecLogger) ErrorWithStruct(obj interface{}, msg string, v ...interface{})

func (SpecLogger) Info

func (l SpecLogger) Info(msg string, v ...interface{})

func (SpecLogger) InfoWithField

func (l SpecLogger) InfoWithField(msg string, v ...zap.Field)

func (SpecLogger) InfoWithMap

func (l SpecLogger) InfoWithMap(obj map[string]interface{}, msg string, v ...interface{})

func (SpecLogger) InfoWithStruct

func (l SpecLogger) InfoWithStruct(obj interface{}, msg string, v ...interface{})

func (SpecLogger) Panic

func (l SpecLogger) Panic(msg string, v ...interface{})

func (SpecLogger) PanicWithField

func (l SpecLogger) PanicWithField(msg string, v ...zap.Field)

func (SpecLogger) PanicWithMap

func (l SpecLogger) PanicWithMap(obj map[string]interface{}, msg string, v ...interface{})

func (SpecLogger) PanicWithStruct

func (l SpecLogger) PanicWithStruct(obj interface{}, msg string, v ...interface{})

func (SpecLogger) Warn

func (l SpecLogger) Warn(msg string, v ...interface{})

func (SpecLogger) WarnWithField

func (l SpecLogger) WarnWithField(msg string, v ...zap.Field)

func (SpecLogger) WarnWithMap

func (l SpecLogger) WarnWithMap(obj map[string]interface{}, msg string, v ...interface{})

func (SpecLogger) WarnWithStruct

func (l SpecLogger) WarnWithStruct(obj interface{}, msg string, v ...interface{})

Jump to

Keyboard shortcuts

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