Skip to content

Commit

Permalink
Merge pull request #43 from DougEdey/de/update_log_params
Browse files Browse the repository at this point in the history
For Rails 7.1 or above, use the named bold param
  • Loading branch information
kenn authored Nov 4, 2023
2 parents 6fbc059 + a8c7787 commit 3174c25
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 3174c25

Please sign in to comment.