Add a log file to track deleted duplicate records

It might be interesting in some cases to check the information related
to those records.
This commit is contained in:
Javi Martín
2024-05-11 18:58:43 +02:00
parent b013a5b1b6
commit b327275d18
2 changed files with 29 additions and 4 deletions

View File

@@ -0,0 +1,21 @@
class DuplicateRecordsLogger
def info(message)
logger.info(message)
end
def logger
@logger ||= ActiveSupport::Logger.new(log_file).tap do |logger|
logger.formatter = Rails.application.config.log_formatter
end
end
private
def log_file
File.join(File.dirname(Rails.application.config.default_log_file), log_filename)
end
def log_filename
"duplicate_records.log"
end
end