diff --git a/asynq_test.go b/asynq_test.go index b68256d..2cbf774 100644 --- a/asynq_test.go +++ b/asynq_test.go @@ -35,7 +35,7 @@ func init() { flag.Var(&testLogLevel, "loglevel", "log level to use in testing") testLogger = log.NewLogger(nil) - testLogger.SetLevel(log.Level(testLogLevel)) + testLogger.SetLevel(toInternalLogLevel(testLogLevel)) } func setup(tb testing.TB) *redis.Client { diff --git a/heartbeat.go b/heartbeat.go index 61f7908..754fb31 100644 --- a/heartbeat.go +++ b/heartbeat.go @@ -38,7 +38,7 @@ func newHeartbeater(l *log.Logger, b base.Broker, ss *base.ServerState, interval } func (h *heartbeater) terminate() { - h.logger.Info("Heartbeater shutting down...") + h.logger.Debug("Heartbeater shutting down...") // Signal the heartbeater goroutine to stop. h.done <- struct{}{} } @@ -54,7 +54,7 @@ func (h *heartbeater) start(wg *sync.WaitGroup) { select { case <-h.done: h.broker.ClearServerState(h.ss) - h.logger.Info("Heartbeater done") + h.logger.Debug("Heartbeater done") return case <-time.After(h.interval): h.beat() diff --git a/processor.go b/processor.go index 092fd37..cc6d26b 100644 --- a/processor.go +++ b/processor.go @@ -106,7 +106,7 @@ func newProcessor(params newProcessorParams) *processor { // It's safe to call this method multiple times. func (p *processor) stop() { p.once.Do(func() { - p.logger.Info("Processor shutting down...") + p.logger.Debug("Processor shutting down...") // Unblock if processor is waiting for sema token. close(p.abort) // Signal the processor goroutine to stop processing tasks @@ -145,7 +145,7 @@ func (p *processor) start(wg *sync.WaitGroup) { for { select { case <-p.done: - p.logger.Info("Processor done") + p.logger.Debug("Processor done") return default: p.exec() diff --git a/scheduler.go b/scheduler.go index aa0a36d..8360135 100644 --- a/scheduler.go +++ b/scheduler.go @@ -41,7 +41,7 @@ func newScheduler(l *log.Logger, b base.Broker, avgInterval time.Duration, qcfg } func (s *scheduler) terminate() { - s.logger.Info("Scheduler shutting down...") + s.logger.Debug("Scheduler shutting down...") // Signal the scheduler goroutine to stop polling. s.done <- struct{}{} } @@ -54,7 +54,7 @@ func (s *scheduler) start(wg *sync.WaitGroup) { for { select { case <-s.done: - s.logger.Info("Scheduler done") + s.logger.Debug("Scheduler done") return case <-time.After(s.avgInterval): s.exec() diff --git a/server.go b/server.go index 2105c88..b694da8 100644 --- a/server.go +++ b/server.go @@ -401,7 +401,6 @@ func (srv *Server) Stop() { return } - fmt.Println() // print newline for prettier log. srv.logger.Info("Starting graceful shutdown") // Note: The order of termination is important. // Sender goroutines should be terminated before the receiver goroutines. @@ -417,7 +416,7 @@ func (srv *Server) Stop() { srv.broker.Close() srv.ss.SetStatus(base.StatusStopped) - srv.logger.Info("Bye!") + srv.logger.Info("Exiting") } // Quiet signals the server to stop pulling new tasks off queues. diff --git a/subscriber.go b/subscriber.go index be7a010..2804bfa 100644 --- a/subscriber.go +++ b/subscriber.go @@ -38,7 +38,7 @@ func newSubscriber(l *log.Logger, b base.Broker, cancelations *base.Cancelations } func (s *subscriber) terminate() { - s.logger.Info("Subscriber shutting down...") + s.logger.Debug("Subscriber shutting down...") // Signal the subscriber goroutine to stop. s.done <- struct{}{} } @@ -60,7 +60,7 @@ func (s *subscriber) start(wg *sync.WaitGroup) { case <-time.After(s.retryTimeout): continue case <-s.done: - s.logger.Info("Subscriber done") + s.logger.Debug("Subscriber done") return } } @@ -71,7 +71,7 @@ func (s *subscriber) start(wg *sync.WaitGroup) { select { case <-s.done: pubsub.Close() - s.logger.Info("Subscriber done") + s.logger.Debug("Subscriber done") return case msg := <-cancelCh: cancel, ok := s.cancelations.Get(msg.Payload) diff --git a/syncer.go b/syncer.go index 018196d..9ea24fc 100644 --- a/syncer.go +++ b/syncer.go @@ -40,7 +40,7 @@ func newSyncer(l *log.Logger, requestsCh <-chan *syncRequest, interval time.Dura } func (s *syncer) terminate() { - s.logger.Info("Syncer shutting down...") + s.logger.Debug("Syncer shutting down...") // Signal the syncer goroutine to stop. s.done <- struct{}{} } @@ -59,7 +59,7 @@ func (s *syncer) start(wg *sync.WaitGroup) { s.logger.Error(req.errMsg) } } - s.logger.Info("Syncer done") + s.logger.Debug("Syncer done") return case req := <-s.requestsCh: requests = append(requests, req)