Module: Output::Devices::Builder

Included in:
File, Stdout, StringIo
Defined in:
lib/output/devices.rb

Defined Under Namespace

Modules: ClassMethods Classes: File, Stdout, StringIo

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



32
33
34
# File 'lib/output/devices.rb', line 32

def self.included(base)
  base.extend ClassMethods
end

Instance Method Details

#build(name, options) ⇒ Object



24
25
26
27
28
29
30
# File 'lib/output/devices.rb', line 24

def build(name, options)
  pattern = options[:pattern]
  layout = self.layout(pattern)
  options = { :layout => layout }.merge(options)

  Logging.appenders.send self.class.device_id, name, options
end

#layout(pattern = Output::Devices::DEFAULT_PATTERN) ⇒ Object



19
20
21
# File 'lib/output/devices.rb', line 19

def layout(pattern = Output::Devices::DEFAULT_PATTERN)
  Logging.layouts.pattern(:pattern => pattern)
end