Merge pull request #6533 from betagouv/move-logging-class

Nettoyage : déplacement de la classe ActiveJobLogSubscriber en dehors des initializers (#6533)
This commit is contained in:
Pierre de La Morinerie 2021-10-12 11:51:35 +02:00 committed by GitHub
commit d1035c05b6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 4 deletions

View file

@ -1,7 +1,7 @@
require 'active_job/logging'
require 'logstash-event'
class ActiveJobLogSubscriber < ::ActiveJob::LogSubscriber
class ActiveJob::ApplicationLogSubscriber < ::ActiveJob::LogSubscriber
def enqueue(event)
process_event(event, 'enqueue')
end

View file

@ -1,5 +1,3 @@
require_relative './active_job_log_subscriber'
Rails.application.configure do
config.lograge.formatter = Lograge::Formatters::Logstash.new
config.lograge.base_controller_class = ['ActionController::Base', 'Manager::ApplicationController']
@ -33,6 +31,6 @@ Rails.application.configure do
config.lograge.logger = ActiveSupport::Logger.new(Rails.root.join('log', "logstash_#{Rails.env}.log"))
if config.lograge.enabled
ActiveJobLogSubscriber.attach_to(:active_job)
ActiveJob::ApplicationLogSubscriber.attach_to(:active_job)
end
end