hotime/error.go

41 lines
472 B
Go
Raw Normal View History

2017-08-04 08:20:59 +00:00
package hotime
2018-04-03 17:54:27 +00:00
import (
2019-07-01 04:35:04 +00:00
"log"
2018-04-03 17:54:27 +00:00
)
2017-08-04 08:20:59 +00:00
//框架层处理错误
type Error struct {
err error
}
func (this *Error) GetError() error {
2017-08-04 08:20:59 +00:00
return this.err
}
func (this *Error) SetError(err error, loglevel ...int) {
2017-08-04 08:20:59 +00:00
this.err = nil
if err == nil {
this.err = err
2018-04-03 17:54:27 +00:00
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
2017-08-04 08:20:59 +00:00
}