Class: LogSinks::EventDrain

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/log_sinks/event_drain.rb

Overview

EventDrain is a single receiver of messages from loggers. EventDrain forward events to registered sinks

Instance Method Summary collapse

Constructor Details

#initializeEventDrain

Returns a new instance of EventDrain.



10
11
12
# File 'lib/log_sinks/event_drain.rb', line 10

def initialize
  @sinks = []
end

Instance Method Details

#add_sink(sink) ⇒ Object



14
15
16
# File 'lib/log_sinks/event_drain.rb', line 14

def add_sink(sink)
  @sinks << sink
end

#clear_sinksObject



22
23
24
# File 'lib/log_sinks/event_drain.rb', line 22

def clear_sinks
  @sinks.clear
end

#drain(event) ⇒ Object



18
19
20
# File 'lib/log_sinks/event_drain.rb', line 18

def drain(event)
  @sinks.each { |s| s.receive(event) }
end