Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Use logger instead of puts #468

Open
wants to merge 1 commit into
base: transition-to-runkit
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions lib/syskit/cli/log_runtime_archive_main.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,15 @@ def self.exit_on_failure?
type: :numeric, default: 25_000, desc: "stop deleting files if \
available space is above this threshold (threshold in MB)"
default_task def watch(root_dir, target_dir)
logger = Logger.new($stdout)
loop do
begin
archive(root_dir, target_dir)
rescue Errno::ENOSPC
next
end

puts "Archived pending logs, sleeping #{options[:period]}s"
logger.info("Archived pending logs, sleeping #{options[:period]}s")
sleep options[:period]
end
end
Expand Down Expand Up @@ -72,6 +73,7 @@ def archive(root_dir, target_dir)
def watch_transfer( # rubocop:disable Metrics/ParameterLists
source_dir, host, port, certificate_path, user, password, implicit_ftps
)
logger = Logger.new($stdout)
loop do
begin
transfer(source_dir, host, port, certificate_path, user, password,
Expand All @@ -80,7 +82,7 @@ def watch_transfer( # rubocop:disable Metrics/ParameterLists
next
end

puts "Transferred pending logs, sleeping #{options[:period]}s"
logger.info("Transferred pending logs, sleeping #{options[:period]}s")
sleep options[:period]
end
end
Expand Down Expand Up @@ -123,11 +125,12 @@ def transfer_server( # rubocop:disable Metrics/ParameterLists
type: :numeric, default: 25_000, desc: "stop deleting files if \
available space is above this threshold (threshold in MB)"
def watch_ensure_free_space(source_dir)
logger = Logger.new($stdout)
loop do
ensure_free_space(source_dir)

puts "Ensured free space in #{source_dir}, " \
"sleeping #{options[:period]}s"
logger.info("Ensured free space in #{source_dir}, " \
"sleeping #{options[:period]}s")
sleep options[:period]
end
end
Expand Down