Class: CodecFactory
- Inherits:
-
Object
- Object
- CodecFactory
- Defined in:
- lib/logstash/inputs/codec_factory.rb
Overview
CodecFactory: lazy-fetch codec plugins
Instance Method Summary collapse
- #get_codec(record) ⇒ Object
-
#initialize(logger, options) ⇒ CodecFactory
constructor
A new instance of CodecFactory.
Constructor Details
#initialize(logger, options) ⇒ CodecFactory
Returns a new instance of CodecFactory.
5 6 7 8 9 10 11 12 |
# File 'lib/logstash/inputs/codec_factory.rb', line 5 def initialize(logger, ) @logger = logger @default_codec = [:default_codec] @codec_by_folder = [:codec_by_folder] @codecs = { 'default' => @default_codec } end |
Instance Method Details
#get_codec(record) ⇒ Object
14 15 16 17 18 19 20 21 |
# File 'lib/logstash/inputs/codec_factory.rb', line 14 def get_codec(record) codec = find_codec(record) if @codecs[codec].nil? @codecs[codec] = get_codec_plugin(codec) end @logger.debug("Switching to codec #{codec}") if codec != 'default' return @codecs[codec].clone end |