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
|
|
|
|
}
|
|
|
|
|
2020-02-20 06:20:56 +00:00
|
|
|
func (this *Error) GetError() error {
|
2017-08-04 08:20:59 +00:00
|
|
|
|
|
|
|
return this.err
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2020-02-20 06:20:56 +00:00
|
|
|
func (this *Error) SetError(err error, loglevel ...int) {
|
2017-08-04 08:20:59 +00:00
|
|
|
|
2020-02-20 06:20:56 +00:00
|
|
|
this.err = nil
|
|
|
|
if err == nil {
|
|
|
|
this.err = err
|
2018-04-03 17:54:27 +00:00
|
|
|
return
|
2020-02-20 06:20:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
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
|
|
|
}
|