Class: LogSinks::EventDrain
- Inherits:
-
Object
- Object
- LogSinks::EventDrain
- 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
- #add_sink(sink) ⇒ Object
- #clear_sinks ⇒ Object
- #drain(event) ⇒ Object
-
#initialize ⇒ EventDrain
constructor
A new instance of EventDrain.
Constructor Details
#initialize ⇒ EventDrain
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_sinks ⇒ Object
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 |