mirror of
https://github.com/yusing/godoxy.git
synced 2025-06-01 01:22:34 +02:00
27 lines
461 B
Go
27 lines
461 B
Go
//go:build debug
|
|
|
|
package task
|
|
|
|
import (
|
|
"runtime/debug"
|
|
|
|
"github.com/rs/zerolog/log"
|
|
)
|
|
|
|
func panicWithDebugStack() {
|
|
panic(string(debug.Stack()))
|
|
}
|
|
|
|
func panicIfFinished(t *Task, reason string) {
|
|
if t.isFinished() {
|
|
log.Panic().Msg("task " + t.String() + " is finished but " + reason)
|
|
}
|
|
}
|
|
|
|
func logStarted(t *Task) {
|
|
log.Info().Msg("task " + t.String() + " started")
|
|
}
|
|
|
|
func logFinished(t *Task) {
|
|
log.Info().Msg("task " + t.String() + " finished")
|
|
}
|