Sha256: a852dacccce32f3f07bc794c7a51a9014670c9ce51fda72d9075dfdb4ab1fa71

Contents?: true

Size: 574 Bytes

Versions: 5

Compression:

Stored size: 574 Bytes

Contents

# frozen_string_literal: true

class Shoes
  class LoggerCollection
    def initialize
      @loggers = []
    end

    def <<(logger)
      @loggers << logger
      self
    end

    def debug(message)
      forward(:debug, message)
    end

    def info(message)
      forward(:info, message)
    end

    def warn(message)
      forward(:warn, message)
    end

    def error(message)
      forward(:error, message)
    end

    private

    def forward(meth, message)
      @loggers.each do |logger|
        logger.public_send(meth, message)
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
shoes-core-4.0.0.rc1 lib/shoes/logger_collection.rb
shoes-core-4.0.0.pre12 lib/shoes/logger_collection.rb
shoes-core-4.0.0.pre11 lib/shoes/logger_collection.rb
shoes-core-4.0.0.pre10 lib/shoes/logger_collection.rb
shoes-core-4.0.0.pre9 lib/shoes/logger_collection.rb