From 5264e308a32a456a528964580dea5dd6d4b91552 Mon Sep 17 00:00:00 2001 From: Phil Lee Date: Tue, 3 Dec 2024 09:38:26 +0000 Subject: [PATCH] patch rails_semantic_logger for rails 8 --- Gemfile.lock | 15 ++++++------- .../rails_semantic_logger_8_monkeypatch.rb | 21 +++++++++++++++++++ db/schema.rb | 4 ++-- 3 files changed, 31 insertions(+), 9 deletions(-) create mode 100644 config/initializers/rails_semantic_logger_8_monkeypatch.rb diff --git a/Gemfile.lock b/Gemfile.lock index e28a01985b..735948d31a 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -309,7 +309,7 @@ GEM listen (3.9.0) rb-fsevent (~> 0.10, >= 0.10.3) rb-inotify (~> 0.9, >= 0.9.10) - logger (1.6.1) + logger (1.6.2) logstasher (2.1.5) activesupport (>= 5.2) request_store @@ -598,7 +598,8 @@ GEM pry (0.14.2) coderay (~> 1.1) method_source (~> 1.0) - psych (5.2.0) + psych (5.2.1) + date stringio public_suffix (6.0.1) puma (6.4.3) @@ -650,10 +651,10 @@ GEM rails-html-sanitizer (1.6.1) loofah (~> 2.21) nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0) - rails_semantic_logger (4.15.0) + rails_semantic_logger (4.17.0) rack railties (>= 5.1) - semantic_logger (~> 4.13) + semantic_logger (~> 4.16) railties (8.0.0) actionpack (= 8.0.0) activesupport (= 8.0.0) @@ -670,7 +671,7 @@ GEM rdoc (6.8.1) psych (>= 4.0.0) regexp_parser (2.9.2) - reline (0.5.11) + reline (0.5.12) io-console (~> 0.5) representable (3.2.0) declarative (< 0.1.0) @@ -737,14 +738,14 @@ GEM sprockets (> 3.0) sprockets-rails tilt - securerandom (0.3.2) + securerandom (0.4.0) selenium-webdriver (4.25.0) base64 (~> 0.2) logger (~> 1.4) rexml (~> 3.2, >= 3.2.5) rubyzip (>= 1.2.2, < 3.0) websocket (~> 1.0) - semantic_logger (4.15.0) + semantic_logger (4.16.1) concurrent-ruby (~> 1.0) sentry-rails (5.21.0) railties (>= 5.0) diff --git a/config/initializers/rails_semantic_logger_8_monkeypatch.rb b/config/initializers/rails_semantic_logger_8_monkeypatch.rb new file mode 100644 index 0000000000..c0557c9080 --- /dev/null +++ b/config/initializers/rails_semantic_logger_8_monkeypatch.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +# see https://github.com/reidmorrison/rails_semantic_logger/issues/249 + +LAST_TESTED_VERSION = "4.17.0" + +require "rails_semantic_logger/version" + +unless RailsSemanticLogger::VERSION == LAST_TESTED_VERSION + raise "rails_semantic_logger is version #{RailsSemanticLogger::VERSION} but the monkey patch was last tested on #{LAST_TESTED_VERSION} - manually check if it supports Rails 8 now and this can be removed, or that this still works as intended" +end + +module LogSubscriberMonkeyPatch + def self.included(base) + base.alias_method(:bind_values, :bind_values_v6_1) + base.alias_method(:render_bind, :render_bind_v6_1) + base.alias_method(:type_casted_binds, :type_casted_binds_v5_1_5) + end +end + +RailsSemanticLogger::ActiveRecord::LogSubscriber.include(LogSubscriberMonkeyPatch) diff --git a/db/schema.rb b/db/schema.rb index b321aed1e0..ff5c7e9cb2 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,12 +10,12 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[7.2].define(version: 2024_11_26_105650) do +ActiveRecord::Schema[8.0].define(version: 2024_11_26_105650) do # These are extensions that must be enabled in order to support this database enable_extension "citext" + enable_extension "pg_catalog.plpgsql" enable_extension "pg_trgm" enable_extension "pgcrypto" - enable_extension "plpgsql" create_table "amendments", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| t.uuid "claim_id"