Module: Logput::Adapters

Defined in:
lib/logput/adapters.rb,
lib/logput/adapters/base.rb,
lib/logput/adapters/logger.rb,
lib/logput/adapters/tagged_logging.rb

Overview

Logging Adapters

Defined Under Namespace

Classes: Base, Logger, TaggedLogging

Class Method Summary collapse

Class Method Details

.obtain(logger) ⇒ Adapter

Find a registered adapter

Returns:

  • (Adapter)

    An instance of the adapter, or raise an exception



12
13
14
15
16
17
# File 'lib/logput/adapters.rb', line 12

def self.obtain(logger)
  registered_adapters.each do |_, adapter|
    return adapter.new(logger) if adapter.handles?(logger)
  end
  raise "#{logger} is not supported."
end

.registered_adaptersHash

Returns Currently registered adapters.

Returns:

  • (Hash)

    Currently registered adapters



6
7
8
# File 'lib/logput/adapters.rb', line 6

def self.registered_adapters
  @registered_adapters ||= {}
end