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

Use logger instead of puts #203

Merged
merged 2 commits into from
May 14, 2024
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion glueby.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Gem::Specification.new do |spec|
spec.add_runtime_dependency 'tapyrus', '>= 0.3.1'
spec.add_runtime_dependency 'activerecord', '>= 7.0', '< 8.0'
spec.add_runtime_dependency 'kaminari'
spec.add_development_dependency 'sqlite3'
spec.add_development_dependency 'sqlite3', '~> 1.4'
spec.add_development_dependency 'mysql2'
spec.add_development_dependency 'rails', '>= 7.0', '< 8.0'
end
8 changes: 6 additions & 2 deletions lib/tasks/glueby/block_syncer.rake
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
require 'tasks/glueby/task_helper'

extend TaskHelper

namespace :glueby do
namespace :contract do
namespace :block_syncer do
desc '[Deprecated use glueby:block_syncer:start instead] sync block into database'
task :start, [] => [:environment] do |_, _|
puts '[Deprecated] glueby:contract:block_syncer:start is deprecated. Use \'glueby:block_syncer:start\''
logger.info('[Deprecated] glueby:contract:block_syncer:start is deprecated. Use \'glueby:block_syncer:start\'')
Rake::Task['glueby:block_syncer:start'].execute
end
end
Expand All @@ -22,7 +26,7 @@ namespace :glueby do
Glueby::BlockSyncer.new(height).run
synced_block.update(info_value: height.to_s)
end
puts "success in synchronization (block height=#{height})"
logger.info("success in synchronization (block height=#{height})")
end
end

Expand Down
11 changes: 11 additions & 0 deletions lib/tasks/glueby/task_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module TaskHelper
def logger
return Rails.logger if Rails.logger

@logger ||= begin
logger = ActiveSupport::Logger.new(STDOUT)
logger.level = Logger::INFO
logger
end
end
end
Loading