Sha256: 35244cc9e41b8d22107908299586cea02840e2ad76852443de91fafc665868b4

Contents?: true

Size: 483 Bytes

Versions: 1

Compression:

Stored size: 483 Bytes

Contents

module Alephant
  module Logger
    class Base
      def initialize(drivers)
        @drivers = drivers << ::Logger.new(STDOUT)
      end

      def method_missing(name, *args)
        drivers.each do |driver|
          driver.send(name, *args) if driver.respond_to? name
        end
      end

      def respond_to?(name)
        drivers.any? do |driver|
          driver.respond_to?(name) || super
        end
      end

      private

      attr_reader :drivers
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
alephant-logger-1.1.1 lib/alephant/logger/base.rb