Skip to content

Commit

Permalink
For Rails 7.1 or above, use the named bold param
Browse files Browse the repository at this point in the history
  • Loading branch information
Doug Edey committed Nov 3, 2023
1 parent 6fbc059 commit 7c42916
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion lib/standby/active_record/log_subscriber.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,16 @@ class LogSubscriber
alias_method :debug_without_standby, :debug

def debug(msg)
db = Standby.disabled ? "" : color("[#{Thread.current[:_standby] || "primary"}]", ActiveSupport::LogSubscriber::GREEN, true)
db = Standby.disabled ? "" : log_header
debug_without_standby(db + msg)
end

def log_header
if "#{Rails::VERSION::MAJOR}.#{Rails::VERSION::MINOR}".to_f > 7.1
color("[#{Thread.current[:_standby] || "primary"}]", ActiveSupport::LogSubscriber::GREEN, bold: true)
else
color("[#{Thread.current[:_standby] || "primary"}]", ActiveSupport::LogSubscriber::GREEN, true)
end
end
end
end

0 comments on commit 7c42916

Please sign in to comment.