Documentation ¶
Index ¶
- Constants
- Variables
- func NewNullLog() *writerLog
- func NewTestingLog(t testing.TB, level LogLevel) *testingLog
- func NewWriterLog(w io.Writer, level LogLevel, cs ...*configstc.LogConfig) *writerLog
- func SetLogger(log ILog)
- type DefaultZapLog
- func (l *DefaultZapLog) Caller(offset int) *DefaultZapLog
- func (l *DefaultZapLog) CallerSkip(offset int) ILog
- func (l *DefaultZapLog) Ctl(t bool) ILog
- func (l *DefaultZapLog) Debug(format string, params ...interface{})
- func (l *DefaultZapLog) Error(format string, params ...interface{})
- func (l *DefaultZapLog) Fatal(format string, params ...interface{})
- func (l *DefaultZapLog) Info(format string, params ...interface{})
- func (l *DefaultZapLog) Panic(format string, params ...interface{})
- func (l *DefaultZapLog) Warn(format string, params ...interface{})
- func (l DefaultZapLog) Write(p []byte) (n int, err error)
- type ILog
- type ILogCallerSkip
- type ILogCtr
- type ILogWriter
- type InvokeLog
- func (ink *InvokeLog) AddLogger(logger ILog)
- func (ink *InvokeLog) Caller(skip int) ILog
- func (ink *InvokeLog) CallerSkip(skip int) ILog
- func (ink *InvokeLog) Ctl(t bool) ILog
- func (ink *InvokeLog) Debug(log string, params ...interface{})
- func (ink *InvokeLog) Error(log string, params ...interface{})
- func (ink *InvokeLog) Fatal(log string, params ...interface{})
- func (ink *InvokeLog) GetLogger() ILog
- func (ink *InvokeLog) Info(log string, params ...interface{})
- func (ink *InvokeLog) Log(level LogLevel, msg string)
- func (ink *InvokeLog) Panic(log string, params ...interface{})
- func (ink *InvokeLog) Warn(log string, params ...interface{})
- func (ink *InvokeLog) Write(p []byte) (n int, err error)
- type LogLevel
- type MyLogger
- func (l *MyLogger) Caller(offset int) ILog
- func (l *MyLogger) CallerSkip(offset int) ILog
- func (l *MyLogger) Ctl(t bool) ILog
- func (l *MyLogger) Debug(format string, params ...interface{})
- func (l *MyLogger) Error(format string, params ...interface{})
- func (l *MyLogger) Fatal(format string, params ...interface{})
- func (l *MyLogger) Info(format string, params ...interface{})
- func (l *MyLogger) LogPath() string
- func (l *MyLogger) Panic(format string, params ...interface{})
- func (l *MyLogger) Warn(format string, params ...interface{})
- func (l *MyLogger) Write(p []byte) (int, error)
- type ZapLogConfig
Constants ¶
View Source
const DefaultLogPath = "./runtime/logs/app.log"
Variables ¶
View Source
var LevelMap = map[LogLevel]string{ TraceLog: "Trace", DebugLog: "Debug", InfoLog: "Info", WarnLog: "Warn", ErrorLog: "Error", FatalLog: "Fatal", PanicLog: "Panic", }
View Source
var LevelMapReverse = map[string]LogLevel{ "Trace": TraceLog, "Debug": DebugLog, "Info": InfoLog, "Warn": WarnLog, "Error": ErrorLog, "Fatal": FatalLog, "Panic": PanicLog, }
View Source
var LogLevelMap = LevelMap
LogLevelMap 兼容旧配置
View Source
var ZapLogLevelMap = map[LogLevel]zapcore.Level{ DebugLog: zapcore.DebugLevel, InfoLog: zapcore.InfoLevel, WarnLog: zapcore.WarnLevel, ErrorLog: zapcore.ErrorLevel, PanicLog: zapcore.PanicLevel, FatalLog: zapcore.FatalLevel, }
Functions ¶
func NewNullLog ¶
func NewNullLog() *writerLog
func NewTestingLog ¶
func NewWriterLog ¶
Types ¶
type DefaultZapLog ¶
type DefaultZapLog struct {
// contains filtered or unexported fields
}
DefaultZapLog default logger
func NewWithZapLog ¶
func NewWithZapLog(zlog *zap.Logger) *DefaultZapLog
func NewZapLog ¶
func NewZapLog(name string, logPath string, cs ...*configstc.LogConfig) *DefaultZapLog
func (*DefaultZapLog) Caller ¶
func (l *DefaultZapLog) Caller(offset int) *DefaultZapLog
func (*DefaultZapLog) CallerSkip ¶
func (l *DefaultZapLog) CallerSkip(offset int) ILog
func (*DefaultZapLog) Ctl ¶
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{})
type ILog ¶
type ILog interface { ILogWriter ILogCtr ILogCallerSkip }
var (
Out ILog = NewWriterLog(os.Stdout, DebugLog)
)
全局logger
type ILogCallerSkip ¶
type ILogWriter ¶
type ILogWriter 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) }
type InvokeLog ¶
type InvokeLog struct {
// contains filtered or unexported fields
}
InvokeLog fast use log in struct
func (*InvokeLog) CallerSkip ¶
type MyLogger ¶
type MyLogger struct {
// contains filtered or unexported fields
}
MyLogger 日志
func (*MyLogger) CallerSkip ¶
Click to show internal directories.
Click to hide internal directories.