module BinlogReaderCommand::Formattable
Constants
- DEFAULT_OPTIONS
Public Class Methods
new(argv = ARGV)
click to toggle source
Calls superclass method
# File lib/fluent/command/binlog_reader.rb, line 124 def initialize(argv = ARGV) super @options.merge!(DEFAULT_OPTIONS) configure_option_parser end
Private Instance Methods
configure_option_parser()
click to toggle source
# File lib/fluent/command/binlog_reader.rb, line 132 def configure_option_parser @options.merge!(config_params: {}) @opt_parser.banner = "Usage: fluent-binlog-reader #{self.class.to_s.split('::').last.downcase} [options] file" @opt_parser.on('-f TYPE', '--format', 'configure output format') do |v| @options[:format] = v.to_sym end @opt_parser.on('-e KEY=VALUE', 'configure formatter config params') do |v| key, value = v.split('=') usage "#{v} is invalid. valid format is like `key=value`" unless value @options[:config_params].merge!(key => value) end end
lookup_formatter(format, params)
click to toggle source
# File lib/fluent/command/binlog_reader.rb, line 148 def lookup_formatter(format, params) conf = Fluent::Config::Element.new('ROOT', '', params, []) formatter = Fluent::Plugin.new_formatter(format) if formatter.respond_to?(:configure) formatter.configure(conf) end formatter rescue => e usage e end