# frozen_string_literal: true require 'logger' ## # Обертка для хранения объекта Logger class LoggerHolder private_class_method :new @instance_mutex = Mutex.new attr_reader :logger def initialize @logger = Logger.new('log.txt') # @logger = Logger.new(STDOUT) end def self.instance return @instance.logger if @instance @instance_mutex.synchronize do @instance ||= new end @instance.logger end end