Skip to content

Commit

Permalink
Merge pull request #3448 from DFE-Digital/patch-semantic-logger
Browse files Browse the repository at this point in the history
Patch rails_semantic_logger for rails 8
  • Loading branch information
asmega authored Dec 3, 2024
2 parents 509c156 + 5264e30 commit 6340595
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 9 deletions.
15 changes: 8 additions & 7 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
21 changes: 21 additions & 0 deletions config/initializers/rails_semantic_logger_8_monkeypatch.rb
Original file line number Diff line number Diff line change
@@ -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)
4 changes: 2 additions & 2 deletions db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 6340595

Please sign in to comment.