lib/fluent/plugin/out_split.rb in fluent-plugin-split-0.0.4 vs lib/fluent/plugin/out_split.rb in fluent-plugin-split-0.1.0
- old
+ new
@@ -1,19 +1,23 @@
# -*- encoding : utf-8 -*-
module Fluent
class SplitOutput < Output
Fluent::Plugin.register_output('split', self)
- def initialize
- super
- end
-
# Define `router` method of v0.12 to support v0.10 or earlier
unless method_defined?(:router)
define_method("router") { Fluent::Engine }
end
+ unless method_defined?(:log)
+ define_method(:log) { $log }
+ end
+
+ def initialize
+ super
+ end
+
config_param :output_tag, :string
config_param :output_key, :string
config_param :format, :string, default: 'csv'
config_param :key_name, :string
config_param :keep_keys, :string, default: ''
@@ -41,12 +45,13 @@
result[key] = value if @keep_keys_array.include?(key)
end
router.emit(output_tag, time, result)
end
end
- chain.next
rescue => e
- $log.warn e.message
- $log.warn e.backtrace.join(', ')
+ log.warn e.message
+ log.warn e.backtrace.join(', ')
+ ensure
+ chain.next
end
end
end