Sha256: b21eb73a14ea012b4d868549a3458541a9ecdc0b436c7f80af6f3b0be1ccd8cb

Contents?: true

Size: 621 Bytes

Versions: 2

Compression:

Stored size: 621 Bytes

Contents

# Logput
module Logput
  # Logging Adapters
  module Adapters
    # @return [Hash] Currently registered adapters
    def self.registered_adapters
      @registered_adapters ||= {}
    end

    # Find a registered adapter
    # @return [Adapter] An instance of the adapter, or raise an exception
    def self.obtain(logger)
      registered_adapters.each do |_, adapter|
        return adapter.new(logger) if adapter.handles?(logger)
      end
      raise "#{logger} is not supported."
    end

    require 'logput/adapters/base'
    require 'logput/adapters/logger'
    require 'logput/adapters/tagged_logging'
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
logput-0.0.5 lib/logput/adapters.rb
logput-0.0.4 lib/logput/adapters.rb