reidmorrison/rails_semantic_logger

Rails 7.1.2 compatibility

rus-max opened this issue · 3 comments

Error with rails 7.1.2

/Users/user/.rvm/gems/ruby-3.1.2/gems/semantic_logger-4.15.0/lib/semantic_logger/levels.rb:28:in `index': Invalid level:#<Proc:0x0000000100bb5f70 /Users/user/.rvm/gems/ruby-3.1.2/gems/activesupport-7.1.2/lib/active_support/log_subscriber.rb:90 (lambda)> being requested. Must be one of [:trace, :debug, :info, :warn, :error, :fatal] (ArgumentError)
  from /Users/user/work/ufintech/rails_semantic_logger/lib/rails_semantic_logger/extensions/active_support/log_subscriber.rb:8:in `silenced?'
  from /Users/user/.rvm/gems/ruby-3.1.2/gems/activesupport-7.1.2/lib/active_support/notifications/fanout.rb:409:in `silenced?'
  from /Users/user/.rvm/gems/ruby-3.1.2/gems/activesupport-7.1.2/lib/active_support/notifications/fanout.rb:311:in `block in listeners_for'
  from /Users/user/.rvm/gems/ruby-3.1.2/gems/activesupport-7.1.2/lib/active_support/notifications/fanout.rb:311:in `reject'
  from /Users/user/.rvm/gems/ruby-3.1.2/gems/activesupport-7.1.2/lib/active_support/notifications/fanout.rb:311:in `listeners_for'
  from /Users/user/work/ufintech/rails_semantic_logger/lib/rails_semantic_logger.rb:40:in `block in unattach'
  from /Users/user/work/ufintech/rails_semantic_logger/lib/rails_semantic_logger.rb:39:in `each'
  from /Users/user/work/ufintech/rails_semantic_logger/lib/rails_semantic_logger.rb:39:in `unattach'
  from /Users/user/work/ufintech/rails_semantic_logger/lib/rails_semantic_logger.rb:33:in `block in swap_subscriber'
  from /Users/user/work/ufintech/rails_semantic_logger/lib/rails_semantic_logger.rb:33:in `each'
  from /Users/user/work/ufintech/rails_semantic_logger/lib/rails_semantic_logger.rb:33:in `swap_subscriber'
  from /Users/user/work/ufintech/rails_semantic_logger/lib/rails_semantic_logger/engine.rb:175:in `block in <class:Engine>'
  from /Users/user/.rvm/gems/ruby-3.1.2/gems/activesupport-7.1.2/lib/active_support/lazy_load_hooks.rb:94:in `block in execute_hook'
  from /Users/user/.rvm/gems/ruby-3.1.2/gems/activesupport-7.1.2/lib/active_support/lazy_load_hooks.rb:87:in `with_execution_control'
  from /Users/user/.rvm/gems/ruby-3.1.2/gems/activesupport-7.1.2/lib/active_support/lazy_load_hooks.rb:92:in `execute_hook'
  from /Users/user/.rvm/gems/ruby-3.1.2/gems/activesupport-7.1.2/lib/active_support/lazy_load_hooks.rb:78:in `block in run_load_hooks'
  from /Users/user/.rvm/gems/ruby-3.1.2/gems/activesupport-7.1.2/lib/active_support/lazy_load_hooks.rb:77:in `each'
  from /Users/user/.rvm/gems/ruby-3.1.2/gems/activesupport-7.1.2/lib/active_support/lazy_load_hooks.rb:77:in `run_load_hooks'
  from /Users/user/.rvm/gems/ruby-3.1.2/gems/railties-7.1.2/lib/rails/application/finisher.rb:93:in `block in <module:Finisher>'
  from /Users/user/.rvm/gems/ruby-3.1.2/gems/railties-7.1.2/lib/rails/initializable.rb:32:in `instance_exec'
  from /Users/user/.rvm/gems/ruby-3.1.2/gems/railties-7.1.2/lib/rails/initializable.rb:32:in `run'
  from /Users/user/.rvm/gems/ruby-3.1.2/gems/railties-7.1.2/lib/rails/initializable.rb:61:in `block in run_initializers'
  from /Users/user/.rvm/rubies/ruby-3.1.2/lib/ruby/3.1.0/tsort.rb:228:in `block in tsort_each'
  from /Users/user/.rvm/rubies/ruby-3.1.2/lib/ruby/3.1.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
  from /Users/user/.rvm/rubies/ruby-3.1.2/lib/ruby/3.1.0/tsort.rb:431:in `each_strongly_connected_component_from'
  from /Users/user/.rvm/rubies/ruby-3.1.2/lib/ruby/3.1.0/tsort.rb:349:in `block in each_strongly_connected_component'
  from /Users/user/.rvm/rubies/ruby-3.1.2/lib/ruby/3.1.0/tsort.rb:347:in `each'
  from /Users/user/.rvm/rubies/ruby-3.1.2/lib/ruby/3.1.0/tsort.rb:347:in `call'
  from /Users/user/.rvm/rubies/ruby-3.1.2/lib/ruby/3.1.0/tsort.rb:347:in `each_strongly_connected_component'
  from /Users/user/.rvm/rubies/ruby-3.1.2/lib/ruby/3.1.0/tsort.rb:226:in `tsort_each'
  from /Users/user/.rvm/rubies/ruby-3.1.2/lib/ruby/3.1.0/tsort.rb:205:in `tsort_each'
  from /Users/user/.rvm/gems/ruby-3.1.2/gems/railties-7.1.2/lib/rails/initializable.rb:60:in `run_initializers'
  from /Users/user/.rvm/gems/ruby-3.1.2/gems/railties-7.1.2/lib/rails/application.rb:423:in `initialize!'
  from /Users/user/.rvm/gems/ruby-3.1.2/gems/railties-7.1.2/lib/rails/railtie.rb:226:in `public_send'
  from /Users/user/.rvm/gems/ruby-3.1.2/gems/railties-7.1.2/lib/rails/railtie.rb:226:in `method_missing'
  from /Users/user/work/ufintech/rails_semantic_logger/test/dummy/config/environment.rb:5:in `<top (required)>'
  from /Users/user/work/ufintech/rails_semantic_logger/test/test_helper.rb:3:in `require_relative'
  from /Users/user/work/ufintech/rails_semantic_logger/test/test_helper.rb:3:in `<top (required)>'
  from /Users/user/work/ufintech/rails_semantic_logger/test/action_controller_test.rb:1:in `require_relative'
  from /Users/user/work/ufintech/rails_semantic_logger/test/action_controller_test.rb:1:in `<top (required)>'
  from <internal:/Users/user/.rvm/rubies/ruby-3.1.2/lib/ruby/site_ruby/3.1.0/rubygems/core_ext/kernel_require.rb>:37:in `require'
  from <internal:/Users/user/.rvm/rubies/ruby-3.1.2/lib/ruby/site_ruby/3.1.0/rubygems/core_ext/kernel_require.rb>:37:in `require'
  from /Users/user/.rvm/gems/ruby-3.1.2/gems/rake-13.1.0/lib/rake/rake_test_loader.rb:21:in `block in <main>'
  from /Users/user/.rvm/gems/ruby-3.1.2/gems/rake-13.1.0/lib/rake/rake_test_loader.rb:6:in `select'
  from /Users/user/.rvm/gems/ruby-3.1.2/gems/rake-13.1.0/lib/rake/rake_test_loader.rb:6:in `<main>'

lib/rails_semantic_logger.rb:61

Change to:

require("rails_semantic_logger/extensions/active_support/log_subscriber") if defined?(ActiveSupport::LogSubscriber) && (Rails::VERSION::MAJOR <= 7 && Rails::VERSION::MINOR <= 1 && Rails::VERSION::TINY < 2)

Seeing this as well

dgm commented

and I was hoping the rails 7.1.2 release would get us back together... :(

I am seeing this as well:

ArgumentError: Invalid level /gems/activesupport-7.1.2/lib/active_support/log_subscriber.rb:90