jobs: move ActiveJobLogSubscriber out of initializers

This is a class of its own, it doesn't need to be in the initializers.
This commit is contained in:
Pierre de La Morinerie 2021-10-07 13:05:27 +02:00
parent 8179c609e0
commit 0b02fce5e4
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