master
Evan Chen 2021-12-19 14:40:01 +08:00
parent df985a3000
commit 7d1e0b7a7b
1 changed files with 5 additions and 1 deletions

View File

@ -7,6 +7,7 @@ import (
cron "github.com/robfig/cron/v3"
"github.com/rs/zerolog"
"github.com/rs/zerolog/log"
"kumoly.io/kumoly/app/util"
)
var l zerolog.Logger
@ -60,7 +61,10 @@ func (t *_task) Run() {
}
defer func() {
if err := recover(); err != nil {
l.Error().Str("error", fmt.Sprint(err)).Msg("")
l.Error().Str("task_id", t.Task.ID).
Str("task_name", t.name).Str("trace", util.Stack()).
Str("error", fmt.Sprint(err)).Msg("task paniced")
} else if t.once {
c.Remove(t.id)
}