Class: LogStash::Outputs::Internal

Inherits:
Base
  • Object
show all
Defined in:
lib/logstash/outputs/internal.rb

Instance Attribute Summary

Attributes inherited from Base

#logger

Instance Method Summary collapse

Constructor Details

#initialize(url, config = {}, &block) ⇒ Internal

Returns a new instance of Internal.



6
7
8
9
# File 'lib/logstash/outputs/internal.rb', line 6

def initialize(url, config={}, &block)
  super
  @callback = block
end

Instance Method Details

#callback(&block) ⇒ Object



27
28
29
# File 'lib/logstash/outputs/internal.rb', line 27

def callback(&block)
  @callback = block
end

#callback=(proc_block) ⇒ Object



33
34
35
# File 'lib/logstash/outputs/internal.rb', line 33

def callback=(proc_block)
  @callback = proc_block
end

#receive(event) ⇒ Object



17
18
19
20
21
22
23
# File 'lib/logstash/outputs/internal.rb', line 17

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

#registerObject



12
13
14
# File 'lib/logstash/outputs/internal.rb', line 12

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