43 lines
461 B
Go
43 lines
461 B
Go
package hotime
|
|
|
|
import (
|
|
"log"
|
|
|
|
)
|
|
|
|
//框架层处理错误
|
|
type Error struct {
|
|
err error
|
|
}
|
|
|
|
func(this *Error)GetError()error{
|
|
|
|
return this.err
|
|
|
|
}
|
|
|
|
func(this *Error)SetError(err error,loglevel ...int){
|
|
|
|
|
|
this.err=nil
|
|
if err==nil{
|
|
this.err=err
|
|
return
|
|
}
|
|
|
|
lev:=Config.GetInt("logLevel")
|
|
|
|
if len(loglevel)!=0{
|
|
lev=loglevel[0]
|
|
}
|
|
|
|
if lev==LOG_FMT{
|
|
log.Println(err)
|
|
}
|
|
if lev==LOG_FILE{
|
|
log.Println(err)
|
|
}
|
|
this.err=err
|
|
return
|
|
}
|