More logging adjustments

Trying to get a nice-looking output
This commit is contained in:
Justin Edmund 2025-01-12 20:21:24 -08:00
parent 21f9b5c6c8
commit dbe77ef949
3 changed files with 12 additions and 11 deletions

View file

@ -16,7 +16,7 @@ module Granblue
end
def download
log_info "#{object_type.capitalize} #{@id}"
log_info "=> #{@id}"
return if @test_mode
SIZES.each do |size|
@ -36,7 +36,7 @@ module Granblue
should_process = should_download?(download_uri, s3_key)
return unless should_process
log_info "-> #{size}:\t#{url}..."
log_info "-> #{size}: #{url}..."
case @storage
when :local
@ -118,7 +118,7 @@ module Granblue
filepath = "#{path}/#{filename}"
download = URI.parse(url).open
log_info "\tDownloading #{size}\t#{url}..."
log_info "-> #{size}:\t#{url}..."
IO.copy_stream(download, filepath)
rescue OpenURI::HTTPError
log_info "\t404 returned\t#{url}"

View file

@ -30,7 +30,7 @@ class PostDeploymentManager
private
def import_new_data
log_header "Importing new data..."
log_header 'Importing new data...'
importer = Granblue::DataImporter.new(
test_mode: @test_mode,
verbose: @verbose
@ -51,7 +51,8 @@ class PostDeploymentManager
end
def rebuild_search_indices
log_header 'Rebuilding search indices...'
log_header 'Rebuilding search indices...', '-'
puts "\n"
[Character, Summon, Weapon, Job].each do |model|
log_verbose "#{model.name}... "
PgSearch::Multisearch.rebuild(model)
@ -61,9 +62,9 @@ class PostDeploymentManager
def display_import_summary
if @new_records.size > 0 || @updated_records.size > 0
log_step "\nImport Summary:"
display_record_summary("New", @new_records)
display_record_summary("Updated", @updated_records)
log_header 'Import Summary', '-'
display_record_summary('New', @new_records)
display_record_summary('Updated', @updated_records)
else
log_step "\nNo new records imported."
end
@ -83,7 +84,7 @@ class PostDeploymentManager
if @test_mode
log_step "\nTEST MODE: Would download images for new and updated records..."
else
log_header "Downloading images...", "+"
log_header 'Downloading images...', '+'
end
[@new_records, @updated_records].each do |records|
@ -110,7 +111,7 @@ class PostDeploymentManager
def download_single_image(type, id, options)
action_text = @test_mode ? 'Would download' : 'Downloading'
storage_text = STORAGE_DESCRIPTIONS[options[:storage]]
log_verbose "#{action_text} images #{storage_text} for #{type} #{id}..."
log_verbose "\n#{action_text} images #{storage_text} for #{type} #{id}...\n"
Granblue::Downloader::DownloadManager.download_for_object(
type,

View file

@ -13,7 +13,7 @@ namespace :deploy do
# Ensure Rails environment is loaded
Rails.application.eager_load!
log_header('Starting post-deploy script...', '*', false)
log_header('Starting post-deploy script...', '-', false)
print "\n"
# Parse and validate storage option