Skip to content

Commit

Permalink
Merge pull request #39 from DocSpring/logger_debug
Browse files Browse the repository at this point in the history
Use 'logger.debug' instead of 'logger.info' for quieter logs by default

Except for Started message to confirm that the publisher is working.
  • Loading branch information
sj26 committed Jul 29, 2023
2 parents d3fe8eb + ebeca7b commit 828ab6a
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lib/sidekiq/cloudwatchmetrics.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand All @@ -73,15 +73,15 @@ def run
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
tick = [tick + INTERVAL, now].max
sleep(tick - now) if tick > now
end

logger.info { "Stopped Sidekiq CloudWatch Metrics Publisher" }
logger.debug { "Stopped Sidekiq CloudWatch Metrics Publisher" }
end

def publish
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 828ab6a

Please sign in to comment.