Documentation
¶
Index ¶
- Constants
- Variables
- func Debugf(format string, args ...interface{})
- func Errorf(format string, args ...interface{})
- func Fatalf(format string, args ...interface{})
- func Infof(format string, args ...interface{})
- func SetLevel(levelName string)
- func SetTimeFormat(s string)
- func Tracef(format string, args ...interface{})
- func Warnf(format string, args ...interface{})
- type Level
- type LevelMeta
- type Log
- type Logger
- func (l *Logger) Debugf(format string, a ...interface{})
- func (l *Logger) DisableNewLine() *Logger
- func (l *Logger) Errorf(format string, a ...interface{})
- func (l *Logger) Fatalf(format string, a ...interface{})
- func (l *Logger) Infof(format string, a ...interface{})
- func (l *Logger) SetLevel(levelName string) *Logger
- func (l *Logger) SetPrefix(prefix string) *Logger
- func (l *Logger) SetTimeFormat(s string) *Logger
- func (l *Logger) Skip(skip int) *Logger
- func (l *Logger) Tracef(format string, a ...interface{})
- func (l *Logger) Warnf(format string, a ...interface{})
Constants ¶
View Source
const ( // Disable non print DisableLevel = iota // Fatal os.exit() FatalLevel // Error print only errors. ErrorLevel // Warn print errors and warnings. WarnLevel // Info print errors, warnings and infos. InfoLevel // Debug will print debug and trace DebugLevel // lightGreen will print trace TraceLevel )
Variables ¶
View Source
var Default = New()
level 默认级别"info"
View Source
var Levels = map[Level]*LevelMeta{ DisableLevel: { Name: "disable", AlternativeNames: []string{"disabled"}, RawText: "", ColorfulText: "", }, FatalLevel: { Name: "fatal", RawText: "[FTAL]", ColorfulText: purple("[FTAL]"), }, ErrorLevel: { Name: "error", RawText: "[ERRO]", ColorfulText: red("[ERRO]"), }, WarnLevel: { Name: "warn", AlternativeNames: []string{"warning"}, RawText: "[WARN]", ColorfulText: orange("[WARN]"), }, InfoLevel: { Name: "info", RawText: "[INFO]", ColorfulText: green("[INFO]"), }, DebugLevel: { Name: "debug", RawText: "[DBUG]", ColorfulText: yellow("[DBUG]"), }, TraceLevel: { Name: "trace", RawText: "[TRCE]", ColorfulText: lightGreen("[TRCE]"), }, }
Levels info
Functions ¶
Types ¶
type Log ¶
type Log struct { // Logger Logger *Logger // Time Time time.Time // Level Level Level Message string NewLine bool }
A Log represents a log line.
Click to show internal directories.
Click to hide internal directories.