hotime/error.go

39 lines
462 B
Go
Raw Normal View History

2017-08-04 08:20:59 +00:00
package hotime
import "fmt"
//框架层处理错误
type Error struct {
err error
}
func(this *Error)GetError()error{
return this.err
}
func(this *Error)SetError(err error,loglevel... int){
SafeMutex("HOTIME-SYSTEM-ERR", func() interface{} {
if err==nil{
this.err=err
return nil
}
lev:=Config.GetInt("logLevel")
if len(loglevel)!=0{
lev=loglevel[0]
}
if lev==LOG_FMT{
fmt.Println(err)
}
this.err=err
return nil
})
}