Documentation
¶
Index ¶
- type AppLogFunc
- type AppLogFuncWithTag
- type Level
- type Logger
- func AsyncLoggerInstance(filename string, logLevel int8, needConsole bool, async bool, ...) *Logger
- func GetLoggerWithConfig(conf *LoggerConfigure) *Logger
- func LoggerInstance(filename string, logLevel int8, needConsole bool, async bool, ...) *Logger
- func LoggerInstanceOnlyConsole(logLevel int8) *Logger
- func LoggerInstanceWithoutConsole(filename string, async bool, logLevel int8) *Logger
- func (that *Logger) D(template string, args ...interface{})
- func (that *Logger) DP(template string, args ...interface{})
- func (that *Logger) DPanic(template string, args ...interface{})
- func (that *Logger) Debug(template string, args ...interface{})
- func (that *Logger) E(template string, args ...interface{})
- func (that *Logger) Error(template string, args ...interface{})
- func (that *Logger) F(template string, args ...interface{})
- func (that *Logger) Fatal(template string, args ...interface{})
- func (that *Logger) I(template string, args ...interface{})
- func (that *Logger) Info(template string, args ...interface{})
- func (that *Logger) KD(skip int, template string, args ...interface{})
- func (that *Logger) KDP(skip int, template string, args ...interface{})
- func (that *Logger) KDPanic(skip int, template string, args ...interface{})
- func (that *Logger) KDebug(skip int, template string, args ...interface{})
- func (that *Logger) KE(skip int, template string, args ...interface{})
- func (that *Logger) KError(skip int, template string, args ...interface{})
- func (that *Logger) KF(skip int, template string, args ...interface{})
- func (that *Logger) KFatal(skip int, template string, args ...interface{})
- func (that *Logger) KI(skip int, template string, args ...interface{})
- func (that *Logger) KInfo(skip int, template string, args ...interface{})
- func (that *Logger) KW(skip int, template string, args ...interface{})
- func (that *Logger) KWarrn(skip int, template string, args ...interface{})
- func (that *Logger) Sync()
- func (that *Logger) W(template string, args ...interface{})
- func (that *Logger) Warrn(template string, args ...interface{})
- type LoggerConfigure
- func (that *LoggerConfigure) BufferSize() int64
- func (that *LoggerConfigure) FlushInterval() int64
- func (that *LoggerConfigure) IsColorful(need bool) *LoggerConfigure
- func (that *LoggerConfigure) SetAsync(async bool, flushInterval, bufferSize int64) *LoggerConfigure
- func (that *LoggerConfigure) SetLevel(level Level) *LoggerConfigure
- func (that *LoggerConfigure) SetLogFile(file string) *LoggerConfigure
- func (that *LoggerConfigure) SetMaxAge(age int) *LoggerConfigure
- func (that *LoggerConfigure) SetRotationTime(time int) *LoggerConfigure
- func (that *LoggerConfigure) ShowConsole(flag bool) *LoggerConfigure
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AppLogFunc ¶
type AppLogFuncWithTag ¶
type Level ¶
type Level int8
const ( // DebugLevel logs are typically voluminous, and are usually disabled in // production. DebugLevel Level = iota - 1 // InfoLevel is the default logging priority. InfoLevel // WarnLevel logs are more important than Info, but don't need individual // human review. WarnLevel // ErrorLevel logs are high-priority. If an application is running smoothly, // it shouldn't generate any error-level logs. ErrorLevel // DPanicLevel logs are particularly important errors. In development the // logger panics after writing the message. DPanicLevel // PanicLevel logs a message, then panics. PanicLevel // FatalLevel logs a message, then calls os.Exit(1). FatalLevel )
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
func AsyncLoggerInstance ¶ added in v0.5.2
func GetLoggerWithConfig ¶
func GetLoggerWithConfig(conf *LoggerConfigure) *Logger
func LoggerInstance ¶
func LoggerInstanceWithoutConsole ¶
var log *zap.Logger
type LoggerConfigure ¶
type LoggerConfigure struct {
Level Level `json:"logLevel"` // 日志等级
Colorful bool `json:"colorful"` // 是否需要彩色
Async bool `json:"async"` // 是否异步输出日志, 默认同步输出
MaxAge int `json:"maxAge"` // 日志最长保留时间, 单位 小时
RotationTime int `json:"rotationTime"` // 日志滚动周期, 单位 小时, 24小时滚动一个文件
ToConsole bool `json:"console"` // 是否输出到控制台
LogFile string `json:"logFile"` // 输出到文件, 如果文件名为空, 则不输出到文件
// contains filtered or unexported fields
}
func NewConfigure ¶
func NewConfigure() *LoggerConfigure
func (*LoggerConfigure) BufferSize ¶ added in v0.5.2
func (that *LoggerConfigure) BufferSize() int64
func (*LoggerConfigure) FlushInterval ¶ added in v0.5.2
func (that *LoggerConfigure) FlushInterval() int64
func (*LoggerConfigure) IsColorful ¶
func (that *LoggerConfigure) IsColorful(need bool) *LoggerConfigure
func (*LoggerConfigure) SetAsync ¶ added in v0.4.5
func (that *LoggerConfigure) SetAsync(async bool, flushInterval, bufferSize int64) *LoggerConfigure
func (*LoggerConfigure) SetLevel ¶
func (that *LoggerConfigure) SetLevel(level Level) *LoggerConfigure
func (*LoggerConfigure) SetLogFile ¶
func (that *LoggerConfigure) SetLogFile(file string) *LoggerConfigure
func (*LoggerConfigure) SetMaxAge ¶
func (that *LoggerConfigure) SetMaxAge(age int) *LoggerConfigure
func (*LoggerConfigure) SetRotationTime ¶
func (that *LoggerConfigure) SetRotationTime(time int) *LoggerConfigure
func (*LoggerConfigure) ShowConsole ¶
func (that *LoggerConfigure) ShowConsole(flag bool) *LoggerConfigure
Click to show internal directories.
Click to hide internal directories.