Documentation ¶
Index ¶
- Constants
- Variables
- func Blue(data []byte) []byte
- func Cyan(data []byte) []byte
- func Gray(data []byte) []byte
- func Green(data []byte) []byte
- func Orange(data []byte) []byte
- func Purple(data []byte) []byte
- func Red(data []byte) []byte
- type Buffer
- type ColorBuffer
- type FdWriter
- type Logger
- func (l *Logger) Debug(v ...interface{})
- func (l *Logger) Debugf(format string, v ...interface{})
- func (l *Logger) Error(v ...interface{})
- func (l *Logger) Errorf(format string, v ...interface{})
- func (l *Logger) Fatal(v ...interface{})
- func (l *Logger) Fatalf(format string, v ...interface{})
- func (l *Logger) Info(v ...interface{})
- func (l *Logger) Infof(format string, v ...interface{})
- func (l *Logger) Output(depth int, prefix Prefix, data string) error
- func (l *Logger) Printf(s string, args ...interface{})
- func (l *Logger) SetLogLevel(level int)
- func (l *Logger) SetOutput(w io.Writer)
- func (l *Logger) Trace(v ...interface{})
- func (l *Logger) Tracef(format string, v ...interface{})
- func (l *Logger) Warn(v ...interface{})
- func (l *Logger) Warnf(format string, v ...interface{})
- type Prefix
Constants ¶
View Source
const ( AllLevel int = iota DebugLevel InfoLevel WarnLevel ErrorLevel FatalLevel OffLevel )
Variables ¶
View Source
var ( FatalPrefix = Prefix{Plain: []byte("[FATAL] "), Color: colorPurple, File: true, ShortFile: true} ErrorPrefix = Prefix{Plain: []byte("[ERROR] "), Color: colorRed, File: true, ShortFile: true} WarnPrefix = Prefix{Plain: []byte("[WARN] "), Color: colorOrange, File: true, ShortFile: true} InfoPrefix = Prefix{Plain: []byte("[INFO] "), Color: colorGreen, File: true, ShortFile: true} DebugPrefix = Prefix{Plain: []byte("[DEBUG] "), Color: colorDefault, File: true, ShortFile: true} TracePrefix = Prefix{Plain: []byte("[TRACE] "), Color: colorGray, File: true, ShortFile: true} )
Functions ¶
Types ¶
type Logger ¶
type Logger struct { L sync.Mutex Color bool Out io.Writer // Debug bool Timestamp bool Quiet bool Buf ColorBuffer Depth int // runtime.Caller() 的深度 LogLevel int }
Logger 日志的底层存储
Click to show internal directories.
Click to hide internal directories.