From d148ea24457d687045f7e54e7d6e89f9a4f0f278 Mon Sep 17 00:00:00 2001 From: eson <474420502@qq.com> Date: Wed, 2 Jan 2019 01:59:34 +0800 Subject: [PATCH] add uid print --- crontab.go | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/crontab.go b/crontab.go index 7d7a424..164a776 100644 --- a/crontab.go +++ b/crontab.go @@ -9,6 +9,8 @@ import ( "strings" "time" + "github.com/satori/go.uuid" + "474420502.top/eson/structure/circular_linked" "github.com/Pallinder/go-randomdata" @@ -42,6 +44,7 @@ func (force *Force) NextTime() time.Time { type Crontab struct { crontab string + uid uuid.UUID force *Force min []timePointer @@ -166,6 +169,12 @@ func (cron *Crontab) String() string { func (cron *Crontab) FromString(crontab string) error { crontab = cron.crontab + uid, err := uuid.NewV4() + if err != nil { + panic(err) + } + cron.uid = uid + cron.interval = nil cron.min = nil cron.hour = nil @@ -295,7 +304,7 @@ func (cron *Crontab) intervalCalculateNextTime(now time.Time) { } - log.Println("success:", cron.trueCount, "count time wait:", isecond, "s") + fmt.Println(cron.uid.String(), "success:", cron.trueCount, " wait:", isecond) } else { @@ -313,7 +322,7 @@ func (cron *Crontab) intervalCalculateNextTime(now time.Time) { } } - log.Println("fail:", cron.failCount, "count time wait:", isecond, "s") + fmt.Println(cron.uid.String(), "fail:", cron.failCount, " wait:", isecond) } iv.Count--