diff --git a/lib/standby/active_record/log_subscriber.rb b/lib/standby/active_record/log_subscriber.rb index 7cfe1e1..3e1faf4 100644 --- a/lib/standby/active_record/log_subscriber.rb +++ b/lib/standby/active_record/log_subscriber.rb @@ -4,9 +4,15 @@ 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