Documentation
¶
Index ¶
- type AppLogFunc
- type AppLogFuncWithTag
- type Level
- type Logger
- func (logger *Logger) D(template string, args ...interface{})
- func (logger *Logger) DP(template string, args ...interface{})
- func (logger *Logger) DPanic(template string, args ...interface{})
- func (logger *Logger) Debug(template string, args ...interface{})
- func (logger *Logger) E(template string, args ...interface{})
- func (logger *Logger) Error(template string, args ...interface{})
- func (logger *Logger) F(template string, args ...interface{})
- func (logger *Logger) Fatal(template string, args ...interface{})
- func (logger *Logger) I(template string, args ...interface{})
- func (logger *Logger) Info(template string, args ...interface{})
- func (logger *Logger) KD(skip int, template string, args ...interface{})
- func (logger *Logger) KDP(skip int, template string, args ...interface{})
- func (logger *Logger) KDPanic(skip int, template string, args ...interface{})
- func (logger *Logger) KDebug(skip int, template string, args ...interface{})
- func (logger *Logger) KE(skip int, template string, args ...interface{})
- func (logger *Logger) KError(skip int, template string, args ...interface{})
- func (logger *Logger) KF(skip int, template string, args ...interface{})
- func (logger *Logger) KFatal(skip int, template string, args ...interface{})
- func (logger *Logger) KI(skip int, template string, args ...interface{})
- func (logger *Logger) KInfo(skip int, template string, args ...interface{})
- func (logger *Logger) KW(skip int, template string, args ...interface{})
- func (logger *Logger) KWarrn(skip int, template string, args ...interface{})
- func (logger *Logger) W(template string, args ...interface{})
- func (logger *Logger) Warrn(template string, args ...interface{})
- type LoggerConfigure
- func (that *LoggerConfigure) IsColorful(need bool) *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 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"` // 是否需要彩色
MaxAge int `json:"maxAge"` // 日志最长保留时间, 单位 小时
RotationTime int `json:"rotationTime"` // 日志滚动周期, 单位 小时, 24小时滚动一个文件
ToConsole bool `json:"console"` // 是否输出到控制台
LogFile string `json:"logFile"` // 输出到文件, 如果文件名为空, 则不输出到文件
}
func NewConfigure ¶
func NewConfigure() *LoggerConfigure
func (*LoggerConfigure) IsColorful ¶
func (that *LoggerConfigure) IsColorful(need bool) *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.