From c49347b533681b8b9b9390354c97133e443a2269 Mon Sep 17 00:00:00 2001 From: Nathan Broadbent Date: Fri, 21 Jul 2023 14:08:58 +1200 Subject: [PATCH 1/2] Use 'logger.debug' instead of 'logger.info' for quieter logs by default --- lib/sidekiq/cloudwatchmetrics.rb | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/sidekiq/cloudwatchmetrics.rb b/lib/sidekiq/cloudwatchmetrics.rb index 42ce3fc..d8cefdc 100644 --- a/lib/sidekiq/cloudwatchmetrics.rb +++ b/lib/sidekiq/cloudwatchmetrics.rb @@ -56,7 +56,7 @@ def initialize(config: Sidekiq, client: Aws::CloudWatch::Client.new, namespace: end def start - logger.info { "Starting Sidekiq CloudWatch Metrics Publisher" } + logger.debug { "Starting Sidekiq CloudWatch Metrics Publisher" } @done = false @thread = safe_thread("cloudwatch metrics publisher", &method(:run)) @@ -67,13 +67,13 @@ def running? end def run - logger.info { "Started Sidekiq CloudWatch Metrics Publisher" } + logger.debug { "Started Sidekiq CloudWatch Metrics Publisher" } # Publish stats every INTERVAL seconds, sleeping as required between runs now = Time.now.to_f tick = now until @stop - logger.info { "Publishing Sidekiq CloudWatch Metrics" } + logger.debug { "Publishing Sidekiq CloudWatch Metrics" } publish now = Time.now.to_f @@ -81,7 +81,7 @@ def run sleep(tick - now) if tick > now end - logger.info { "Stopped Sidekiq CloudWatch Metrics Publisher" } + logger.debug { "Stopped Sidekiq CloudWatch Metrics Publisher" } end def publish @@ -257,12 +257,12 @@ def publish end def quiet - logger.info { "Quieting Sidekiq CloudWatch Metrics Publisher" } + logger.debug { "Quieting Sidekiq CloudWatch Metrics Publisher" } @stop = true end def stop - logger.info { "Stopping Sidekiq CloudWatch Metrics Publisher" } + logger.debug { "Stopping Sidekiq CloudWatch Metrics Publisher" } @stop = true @thread.wakeup @thread.join From ebeca7b8ba8c884937a97fdaacef45be946d4d5c Mon Sep 17 00:00:00 2001 From: Samuel Cochran Date: Sat, 29 Jul 2023 18:51:19 +1000 Subject: [PATCH 2/2] Keep the "Started" message using info Otherwise there is no way to tell if the gem is working. --- lib/sidekiq/cloudwatchmetrics.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/sidekiq/cloudwatchmetrics.rb b/lib/sidekiq/cloudwatchmetrics.rb index d8cefdc..5bef02d 100644 --- a/lib/sidekiq/cloudwatchmetrics.rb +++ b/lib/sidekiq/cloudwatchmetrics.rb @@ -67,7 +67,7 @@ def running? end def run - logger.debug { "Started Sidekiq CloudWatch Metrics Publisher" } + logger.info { "Started Sidekiq CloudWatch Metrics Publisher" } # Publish stats every INTERVAL seconds, sleeping as required between runs now = Time.now.to_f