Documentation
¶
Index ¶
- Constants
- Variables
- type Log
- func (l *Log) AddFlag(flag int) *Log
- func (l *Log) Debug(v ...interface{})
- func (l *Log) Debugf(format string, v ...interface{})
- func (l *Log) Error(v ...interface{})
- func (l *Log) Errorf(format string, v ...interface{})
- func (parent *Log) Extend(options ...LogOption) *Log
- func (l *Log) Fatal(v ...interface{})
- func (l *Log) Fatalf(format string, v ...interface{})
- func (l *Log) Flag() int
- func (l *Log) Info(v ...interface{})
- func (l *Log) Infof(format string, v ...interface{})
- func (l *Log) Level() logLevel
- func (l *Log) Name() string
- func (l *Log) Order() []logOrder
- func (l *Log) Out(calldepth int, level logLevel, msg string) error
- func (l *Log) Output() io.Writer
- func (l *Log) Panic(v ...interface{})
- func (l *Log) Panicf(format string, v ...interface{})
- func (l *Log) Prefix() string
- func (l *Log) SetFlag(flag int) *Log
- func (l *Log) SetLevel(level logLevel) *Log
- func (l *Log) SetName(name string) *Log
- func (l *Log) SetOrder(orders ...logOrder) *Log
- func (l *Log) SetOutput(w io.Writer) *Log
- func (l *Log) SetPrefix(prefix string) *Log
- func (l *Log) SubFlag(flag int) *Log
- func (l *Log) Trace(v ...interface{})
- func (l *Log) Tracef(format string, v ...interface{})
- func (l *Log) Warn(v ...interface{})
- func (l *Log) Warnf(format string, v ...interface{})
- type LogOption
- type Logger
Constants ¶
View Source
const ( FatalLevel logLevel = iota // 致命的错误: 表明程序遇到了致命的错误,必须马上终止运行。 PanicLevel // 致命的错误: 表明程序遇到了致命的错误,可以不马上终止运行,依赖 recover()。 ErrorLevel // 状态错误: 该错误发生后程序仍然可以运行,但是极有可能运行在某种非正常的状态下,导致无法完成全部既定的功能。 WarnLevel // 警告信息: 程序处理中遇到非法数据或者某种可能的错误。该错误是一过性的、可恢复的,不会影响程序继续运行,程序仍处在正常状态。 InfoLevel // 报告程序进度和状态信息: 一般这种信息都是一过性的,不会大量反复输出。例如:连接商用库成功后,可以打印一条连库成功的信息,便于跟踪程序进展信息。 DebugLevel // 终端查看、在线调试: 默认情况下会打印到终端输出,但是不会归档到日志文件。因此,一般用于开发者在程序当前启动窗口上,查看日志流水信息。 TraceLevel // 在线调试: 默认情况下,既不打印到终端也不输出到文件。此时,对程序运行效率几乎不产生影响。常用语 for 循环中调试 Discard )
View Source
const ( Ldate = 1 << iota Ltime Lmicroseconds LUTC Llongfile Lshortfile Lmsgprefix Lmsgcolor Llevel LstdFlags = Ldate | Ltime | Lshortfile | Llevel )
Flag set include setting of date, time, path, prefix, level, msg
View Source
const ( OrderDate logOrder = "Date" OrderTime logOrder = "Time" OrderLevel logOrder = "Level" OrderPrefix logOrder = "Prefix" OrderPath logOrder = "Path" OrderMsg logOrder = "Message" )
Variables ¶
View Source
var ( // Getter & Setter Output = std.Output Level = std.Level Name = std.Name Prefix = std.Prefix Order = std.Order Flag = std.Flag SetOutput = std.SetOutput SetLevel = std.SetLevel SetName = std.SetName SetPrefix = std.SetPrefix SetOrder = std.SetOrder SetFlag = std.SetFlag // Method Set Fatal = std.Fatal Panic = std.Panic Error = std.Error Warn = std.Warn Info = std.Info Debug = std.Debug Trace = std.Trace Fatalf = std.Fatalf Panicf = std.Panicf Errorf = std.Errorf Warnf = std.Warnf Infof = std.Infof Debugf = std.Debugf Tracef = std.Tracef )
Functions ¶
This section is empty.
Types ¶
type Log ¶
type Log struct {
// contains filtered or unexported fields
}
func Default ¶
func Default() *Log
============================== Default global object ====================================== ¶
type Logger ¶
type Logger interface {
Fatal(...interface{})
Panic(...interface{})
Error(...interface{})
Warn(...interface{})
Info(...interface{})
Debug(...interface{})
Trace(...interface{})
Fatalf(string, ...interface{})
Panicf(string, ...interface{})
Errorf(string, ...interface{})
Warnf(string, ...interface{})
Infof(string, ...interface{})
Debugf(string, ...interface{})
Tracef(string, ...interface{})
}
Click to show internal directories.
Click to hide internal directories.