Skip to content

Commit

Permalink
fix color method bold option
Browse files Browse the repository at this point in the history
> Bolding log text with a positional boolean is deprecated and will be removed in Rails 7.2. Use an option hash instead (eg. `color("my text", :red, bold: true)`).
  • Loading branch information
fumihumi committed Oct 11, 2023
1 parent b50efb8 commit e665b3a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/octoball/log_subscriber.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@ def sql(event)
private

def debug(progname = nil, &block)
conn = current_shard ? color("[Shard: #{current_shard}]", ActiveSupport::LogSubscriber::GREEN, true) : ''
if ActiveRecord.gem_version >= Gem::Version.new('7.1.0')
conn = current_shard ? color("[Shard: #{current_shard}]", ActiveSupport::LogSubscriber::GREEN, bold: true) : ''
else
conn = current_shard ? color("[Shard: #{current_shard}]", ActiveSupport::LogSubscriber::GREEN, true) : ''
end
super(conn + progname.to_s, &block)
end
end
Expand Down

0 comments on commit e665b3a

Please sign in to comment.