log

package
v1.1.23 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2022 License: GPL-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

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

Variables

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

Functions

This section is empty.

Types

type DefaultZapLog

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

default logger

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{})

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{})
}

func NewDefaultLogger

func NewDefaultLogger(c *MyLoggerConfig) ILog

func NewZapLog

func NewZapLog(name string, logPath string, config *ZapLogConfig) ILog

type InvokeLog

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

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) 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
}

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

最终日志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 MyLoggerConfig

type MyLoggerConfig struct {
	Module         string
	Path           string
	PathAutoCreate bool
	ConsoleOut     bool
	Flag           int
	LogLevel       string
}

func (*MyLoggerConfig) LogPath

func (c *MyLoggerConfig) LogPath() string

type ZapLogConfig

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

	LogLevel string //日志级别
}

Jump to

Keyboard shortcuts

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