Sha256: eb29a2e4dafcc805cfc0f07be2e45b8b181693c523c21a910df72cbf150b9454

Contents?: true

Size: 368 Bytes

Versions: 13

Compression:

Stored size: 368 Bytes

Contents

# frozen_string_literal: true

require 'logger'

class LoggerHolder
  private_class_method :new
  @instance_mutex = Mutex.new

  attr_reader :logger

  def initialize
    @logger = Logger.new(STDOUT)
  end

  def self.instance
    return @instance.logger if @instance

    @instance_mutex.synchronize do
      @instance ||= new
    end

    @instance.logger
  end
end

Version data entries

13 entries across 13 versions & 4 rubygems

Version Path
rybish_code-2.0.0 lib/source/util/logger_holder.rb
rybish_code-1.1.6 lib/source/util/logger_holder.rb
rybish_code-1.1.4 lib/source/util/logger_holder.rb
shnaider_code-1.1.6 lib/source/util/logger_holder.rb
jewerly_system-1.0.0 lib/source/util/logger_holder.rb
rubbish_code-1.1.4 lib/source/util/logger_holder.rb
rubbish_code-1.1.3 lib/source/util/logger_holder.rb
rubbish_code-1.1.2 lib/source/util/logger_holder.rb
rubbish_code-1.1.1 lib/source/util/logger_holder.rb
rubbish_code-1.1.0 lib/source/util/logger_holder.rb
rubbish_code-1.0.0 lib/source/util/logger_holder.rb
rubbish_code-0.1.4 lib/source/util/logger_holder.rb
rubbish_code-0.1.3 util/logger_holder.rb