iedc-go/error.go
2017-11-14 10:27:09 +00:00

43 lines
524 B
Go

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(MUTEX_HOTIME_SYSTEM_ERR, func() interface{} {
this.err=nil
if err==nil{
this.err=err
return nil
}
lev:=Config.GetInt("LOG_NIL")
if len(loglevel)!=0{
lev=loglevel[0]
}
if lev==LOG_FMT{
fmt.Println(err)
}
if lev==LOG_FILE{
fmt.Println(err)
}
this.err=err
return nil
})
}