From 7d1e0b7a7b4fbb30e6e366a1a1660433dea2be48 Mon Sep 17 00:00:00 2001 From: Evan Chen Date: Sun, 19 Dec 2021 14:40:01 +0800 Subject: [PATCH] update --- task/task.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/task/task.go b/task/task.go index eb90dd6..0a9e355 100644 --- a/task/task.go +++ b/task/task.go @@ -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) }