Sha256: c0ff77fb51d32304340a55e68a63ef72638c236acdeebb0b7f0a66bf8f2d47ee

Contents?: true

Size: 357 Bytes

Versions: 11

Compression:

Stored size: 357 Bytes

Contents

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

11 entries across 11 versions & 4 rubygems

Version Path
mc_gem3-1.0.2 lib/source/logger_holder.rb
mc_gem3-1.0.0 lib/source/logger_holder.rb
mc_gem2-1.1.5 lib/source/logger_holder.rb
mc_gem2-1.1.4 lib/source/logger_holder.rb
mvcStudentXD-1.2.3 lib/source/util/LoggerHolder.rb
mc_gem-0.0.1 mc_gem/lib/source/util/LoggerHolder.rb
mvcStudentXD-1.2.2 lib/source/util/LoggerHolder.rb
mvcStudentXD-1.2.1 mvcStudentXD/lib/source/util/LoggerHolder.rb
mvcStudentXD-1.2.0 lib/source/util/LoggerHolder.rb
mvcStudentXD-1.1.3 lib/source/util/LoggerHolder.rb
mvcStudentXD-1.1.2 lib/util/LoggerHolder.rb