log

package
v1.1.45 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2024 License: GPL-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DebugLog = 1 << iota
	TraceLog
	InfoLog
	WarnLog
	ErrorLog
	PanicLog
	FatalLog
)
View Source
const DefaultLogPath = "./runtime/logs/app.log"

Variables

View Source
var LogLevelMap = map[int]string{
	TraceLog: "Trace",
	DebugLog: "Debug",
	InfoLog:  "Info",
	WarnLog:  "Warning",
	ErrorLog: "Error",
	FatalLog: "Fatal",
	PanicLog: "Panic",
}

Functions

func NewNullLog added in v1.1.43

func NewNullLog() *writerLog

func NewWriterLog added in v1.1.45

func NewWriterLog(w io.Writer, level int) *writerLog

Types

type DefaultZapLog

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

DefaultZapLog default logger

func NewZapLog

func NewZapLog(name string, logPath string, c *config.LogConfig) *DefaultZapLog

func (*DefaultZapLog) Caller added in v1.1.39

func (l *DefaultZapLog) Caller(offset int) *DefaultZapLog

func (*DefaultZapLog) Ctl added in v1.1.44

func (l *DefaultZapLog) Ctl(t bool) ILog

func (*DefaultZapLog) Debug

func (l *DefaultZapLog) Debug(format string, params ...interface{})

func (*DefaultZapLog) Error

func (l *DefaultZapLog) Error(format string, params ...interface{})

func (*DefaultZapLog) Fatal

func (l *DefaultZapLog) Fatal(format string, params ...interface{})

func (*DefaultZapLog) Info

func (l *DefaultZapLog) Info(format string, params ...interface{})

func (*DefaultZapLog) Panic

func (l *DefaultZapLog) Panic(format string, params ...interface{})

func (*DefaultZapLog) Warn

func (l *DefaultZapLog) Warn(format string, params ...interface{})

func (DefaultZapLog) Write added in v1.1.45

func (l DefaultZapLog) Write(p []byte) (n int, err error)

type ILog

type ILog interface {
	Debug(log string, params ...interface{})
	Info(log string, params ...interface{})
	Warn(log string, params ...interface{})
	Error(log string, params ...interface{})
	Panic(log string, params ...interface{})
	Fatal(log string, params ...interface{})
	Write(p []byte) (n int, err error)

	Ctl(bool) ILog //控制是否打印,如 Ctl(true).Warn(...)
}

func NewDefaultLogger

func NewDefaultLogger(name string, c *config.LogConfig) ILog

type InvokeLog

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

InvokeLog fast use log

func (*InvokeLog) AddLogger

func (ink *InvokeLog) AddLogger(logger ILog)

func (*InvokeLog) Debug

func (ink *InvokeLog) Debug(log string, params ...interface{})

func (*InvokeLog) Error

func (ink *InvokeLog) Error(log string, params ...interface{})

func (*InvokeLog) Fatal

func (ink *InvokeLog) Fatal(log string, params ...interface{})

func (*InvokeLog) GetLogger added in v1.1.43

func (ink *InvokeLog) GetLogger() ILog

func (*InvokeLog) Info

func (ink *InvokeLog) Info(log string, params ...interface{})

func (*InvokeLog) Log

func (ink *InvokeLog) Log(level int8, msg string)

func (*InvokeLog) Panic

func (ink *InvokeLog) Panic(log string, params ...interface{})

func (*InvokeLog) Warn

func (ink *InvokeLog) Warn(log string, params ...interface{})

type MyLogger

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

MyLogger 日志

func (*MyLogger) Ctl added in v1.1.44

func (logger *MyLogger) Ctl(t bool) ILog

func (*MyLogger) Debug

func (logger *MyLogger) Debug(format string, params ...interface{})

func (*MyLogger) Error

func (logger *MyLogger) Error(format string, params ...interface{})

func (*MyLogger) Fatal

func (logger *MyLogger) Fatal(format string, params ...interface{})

func (*MyLogger) Info

func (logger *MyLogger) Info(format string, params ...interface{})

func (*MyLogger) LogPath

func (logger *MyLogger) LogPath() string

LogPath 最终日志path

func (*MyLogger) Panic

func (logger *MyLogger) Panic(format string, params ...interface{})

func (*MyLogger) Path

func (logger *MyLogger) Path() string

设置的path

func (*MyLogger) Warn

func (logger *MyLogger) Warn(format string, params ...interface{})

func (*MyLogger) Write

func (logger *MyLogger) Write(p []byte) (int, error)

type ZapLogConfig

type ZapLogConfig struct {
	SyncStdOut bool //是否同步输出至标准输出
	MaxSize    int  // 每个日志文件保存的大小 单位:M
	MaxAge     int  // 文件最多保存多少天
	MaxBackups int  // 日志文件最多保存多少个备份
	Compress   bool // 是否压缩

	LogLevel string //日志级别
}

ZapLogConfig 日志配置,已经废弃,请使用config.LogConfig

Jump to

Keyboard shortcuts

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