Sha256: f2ac5850f2b8b8271f341044c41df90262c1a78d368f57ae097f2eb7620ba37b

Contents?: true

Size: 1.06 KB

Versions: 28

Compression:

Stored size: 1.06 KB

Contents

# encoding: utf-8
require "logstash/namespace"
require "logstash/event"
require "logstash/plugin"
require "logstash/logging"

# This is the base class for logstash codecs.
module LogStash::Codecs; class Base < LogStash::Plugin
  include LogStash::Config::Mixin
  config_name "codec"

  def initialize(params={})
    super
    config_init(@params)
    register if respond_to?(:register)
  end

  public
  def decode(data)
    raise "#{self.class}#decode must be overidden"
  end # def decode

  alias_method :<<, :decode

  public
  def encode(event)
    raise "#{self.class}#encode must be overidden"
  end # def encode

  public
  def close; end;

  # @param block [Proc(event, data)] the callback proc passing the original event and the encoded event
  public
  def on_event(&block)
    @on_event = block
  end

  public
  def flush(&block)
    # does nothing by default.
    # if your codec needs a flush method (like you are spooling things)
    # you must implement this.
  end

  public
  def clone
    return self.class.new(params)
  end
end; end # class LogStash::Codecs::Base

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
logstash-core-2.4.0.snapshot1-java lib/logstash/codecs/base.rb
logstash-core-2.3.4-java lib/logstash/codecs/base.rb
logstash-core-2.3.4.snapshot1-java lib/logstash/codecs/base.rb
logstash-core-2.3.3-java lib/logstash/codecs/base.rb
logstash-core-2.3.3.snapshot2-java lib/logstash/codecs/base.rb
logstash-core-2.3.3.snapshot1-java lib/logstash/codecs/base.rb
logstash-core-2.3.2-java lib/logstash/codecs/base.rb
logstash-core-2.3.2.snapshot1-java lib/logstash/codecs/base.rb
logstash-core-2.2.4-java lib/logstash/codecs/base.rb
logstash-core-2.3.1-java lib/logstash/codecs/base.rb
logstash-core-2.2.4.snapshot2-java lib/logstash/codecs/base.rb
logstash-core-2.2.4.snapshot1 lib/logstash/codecs/base.rb
logstash-core-2.3.1.snapshot1-java lib/logstash/codecs/base.rb
logstash-core-5.0.0.alpha1-java lib/logstash/codecs/base.rb
logstash-core-5.0.0.alpha1.snapshot2-java lib/logstash/codecs/base.rb
logstash-core-5.0.0.alpha1.snapshot1-java lib/logstash/codecs/base.rb
logstash-core-2.2.3-java lib/logstash/codecs/base.rb
logstash-core-2.3.0-java lib/logstash/codecs/base.rb
logstash-core-2.3.0.snapshot5-java lib/logstash/codecs/base.rb
logstash-core-2.2.3.snapshot2-java lib/logstash/codecs/base.rb