Class/Module Index [+]

Quicksearch

Fluent::TextFormatter

Constants

TEMPLATE_REGISTRY

Public Class Methods

create(conf) click to toggle source
# File lib/fluent/formatter.rb, line 157
def self.create(conf)
  format = conf['format']
  if format.nil?
    raise ConfigError, "'format' parameter is required"
  end

  # built-in template
  begin
    factory = TEMPLATE_REGISTRY.lookup(format)
  rescue ConfigError => e
    raise ConfigError, "unknown format: '#{format}'"
  end

  formatter = factory.call
  formatter.configure(conf)
  formatter
end
register_template(name, factory_or_proc) click to toggle source
# File lib/fluent/formatter.rb, line 147
def self.register_template(name, factory_or_proc)
  factory = if factory_or_proc.arity == 3
              Proc.new { factory_or_proc }
            else
              factory_or_proc
            end

  TEMPLATE_REGISTRY.register(name, factory)
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.