From 684d82f7bd1a66532b9f3b4f3a1f15a695842d4d Mon Sep 17 00:00:00 2001 From: bryanqiu Date: Thu, 20 Apr 2023 16:40:02 +0800 Subject: [PATCH] change log --- uid.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/uid.go b/uid.go index a7be50b..5a37361 100644 --- a/uid.go +++ b/uid.go @@ -100,8 +100,8 @@ func (idg *idCreator) backgroudTaskForGenerateRange() { // doing range generator for i := 0; ; i++ { + logStr := "" log.SetLogid(fmt.Sprintf("uidcreator%07d", i)) - log.PrintPretty("backgroud info, ranges:", idg.Ranges) for prefix, queue := range idg.Ranges { var qlen = queue.Len() var timeoutMs = 1 * time.Millisecond @@ -120,6 +120,12 @@ func (idg *idCreator) backgroudTaskForGenerateRange() { } else if int(timeoutMs) < 0 { time.Sleep(-timeoutMs) } + if i%50 == 0 { + logStr += fmt.Sprintf("queue-legth:(%s,%d);", prefix, queue.Len()) + } + } + if i%50 == 0 { + log.Infof("backgroud idcreator info: %s", logStr) } time.Sleep(3000 * time.Millisecond) }