Documentation
¶
Index ¶
- Variables
- func CatchError(err error) bool
- func Debug(msg ...string)
- func Error(msg ...string)
- func Fatal(msg ...string)
- func Info(msg ...string)
- func SetLogLevel(level int) int
- func Trace(msg ...string)
- func Warn(msg ...string)
- type CommonLog
- type IElement
- type ILog
- type ITag
- type LogDate
- type LogTag
- type MsgAttribute
- type SimpleLog
Constants ¶
This section is empty.
Variables ¶
View Source
var ( LOGLEVEL_SLIENT int = 7 LOGLEVEL_FATAL int = 6 LOGLEVEL_ERROR int = 5 LOGLEVEL_WARN int = 4 LOGLEVEL_INFO int = 3 LOGLEVEL_DEBUG int = 2 LOGLEVEL_TRACE int = 1 LOGLEVEL_ALL int = 0 LOGTAG_FATAL string = "FATAL" LOGTAG_ERROR string = "ERROR" LOGTAG_WARN string = "WARN" LOGTAG_INFO string = "INFO" LOGTAG_DEBUG string = "DEBUG" LOGTAG_TRACE string = "TRACE" )
7:slient/off:完全不输出信息 6:fatal:导致程序退出,输出程序退出时的错误信息 5:error:错误信息 4:warn:警告信息 3:info:用于输出信息 2:debug:输出调试信息 1:trace: 程序运行时的跟踪信息 0:all: 所有信息
View Source
var ( // Unified log date format UnifiedLogData LogDate // unified log format UnifiedLogTag LogTag // unified format UnifiedLogFormatString string )
Functions ¶
func CatchError ¶ added in v0.0.11
运行时错误。当err不为空时,会提示错误信息,并且会打印函数的调用堆栈。 可以将上层的err直接传到这里,这里处理err。 demo: _, err := function() if CatchError(err) { ......处理错误的代码 } @param err @return bool。如果返回true,表明有错误;false没有发生错误。
Types ¶
type CommonLog ¶ added in v0.0.15
type CommonLog struct { DateElement LogDate FatalTag LogTag ErrorTag LogTag InfoTag LogTag WarnTag LogTag DebugTag LogTag TraceTag LogTag Format string MsgAttr MsgAttribute }
func NewCommonLog ¶ added in v0.0.15
func NewCommonLog() CommonLog
func (CommonLog) Fatal ¶ added in v0.0.15
//////////////////////////////////////////////////// //////////////////////////////////////////////////// //////////////////////////////////////////////////// 打印fatal级别的日志
type LogDate ¶ added in v0.0.5
type LogDate struct { FormatString string Font color.Attribute Bgcolor color.Attribute Fgcolor color.Attribute }
func (LogDate) ToColorString ¶ added in v0.0.15
type LogTag ¶ added in v0.0.15
type LogTag struct { FormatString string Font color.Attribute Bgcolor color.Attribute Fgcolor color.Attribute }
func (LogTag) ToColorString ¶ added in v0.0.15
type MsgAttribute ¶ added in v0.0.5
func (MsgAttribute) GenColor ¶ added in v0.0.15
func (m MsgAttribute) GenColor() color.Color
Click to show internal directories.
Click to hide internal directories.