Module: Yell::Helpers::Adapter

Included in:
Logger
Defined in:
lib/yell/helpers/adapter.rb

Overview

:nodoc:

Instance Method Summary collapse

Instance Method Details

#adapter(type = :file, *args, &block) ⇒ Yell::Adapter

Define an adapter to be used for logging.

Examples:

Standard adapter

adapter :file

Standard adapter with filename

adapter :file, 'development.log'

# Alternative notation for filename in options
adapter :file, :filename => 'developent.log'

Standard adapter with filename and additional options

adapter :file, 'development.log', :level => :warn

Set the adapter directly from an adapter instance

adapter Yell::Adapter::File.new

Parameters:

  • type (Symbol) (defaults to: :file)

    The type of the adapter, may be ‘:file` or `:datefile` (default `:file`)

Returns:

  • (Yell::Adapter)

    The instance

Raises:

  • (Yell::NoSuchAdapter)

    Will be thrown when the adapter is not defined



26
27
28
# File 'lib/yell/helpers/adapter.rb', line 26

def adapter( type = :file, *args, &block )
  adapters.add(type, *args, &block)
end

#adaptersObject



30
31
32
# File 'lib/yell/helpers/adapter.rb', line 30

def adapters
  @__adapters__
end