38
39
40
41
42
43
44
45
46
47
48
49
|
# File 'lib/fluent/compat/formatter.rb', line 38
def self.register_template(type, template)
if template.is_a?(Class)
Fluent::Plugin.register_formatter(type, template)
elsif template.respond_to?(:call) && template.arity == 3
Fluent::Plugin.register_formatter(type, Proc.new { ProcWrappedFormatter.new(template) })
elsif template.respond_to?(:call)
Fluent::Plugin.register_formatter(type, template)
else
raise ArgumentError, "Template for formatter must be a Class or callable object"
end
end
|