Sha256: 7a49a94d01eef7fcb5d4322e6f75867a9e94487a5404a43d7ee324ed7031ad7b

Contents?: true

Size: 770 Bytes

Versions: 9

Compression:

Stored size: 770 Bytes

Contents

require "logstash/namespace"
require "logstash/outputs/base"

class LogStash::Outputs::Internal < LogStash::Outputs::Base
  public
  def initialize(url, config={}, &block)
    super
    @callback = block
  end # def initialize

  public
  def register
    @logger.info("Registering output #{@url}")
  end # def register

  public
  def receive(event)
    if !@callback
      @logger.error("No callback for output #{@url}, cannot receive")
      return
    end
    @callback.call(event)
  end # def event

  # Set the callback by passing a block of code
  public
  def callback(&block)
    @callback = block
  end

  # Set the callback by passing a proc object
  public
  def callback=(proc_block)
    @callback = proc_block
  end
end # class LogStash::Outputs::Internal

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
logstash-lite-0.2.20110505142231 lib/logstash/outputs/internal.rb
logstash-lite-0.2.20110422152244 lib/logstash/outputs/internal.rb
logstash-lite-0.2.20110405105201 lib/logstash/outputs/internal.rb
logstash-lite-0.2.20110331121236 lib/logstash/outputs/internal.rb
logstash-lite-0.2.20110329105411 lib/logstash/outputs/internal.rb
logstash-lite-0.2.20110206003603 lib/logstash/outputs/internal.rb
logstash-lite-0.2.20110203130400 lib/logstash/outputs/internal.rb
logstash-lite-0.2.20110122143801 lib/logstash/outputs/internal.rb
logstash-lite-0.2.20110112115019 lib/logstash/outputs/internal.rb