class Hallmonitor::Dispatcher

Public Class Methods

add_outputter(outputter) click to toggle source

Adds an outputter. Outputters are required to respond to :process @param outputter [Object] @see Hallmonitor::Outputters::StatsdOutputter

# File lib/hallmonitor/dispatcher.rb, line 14
def self.add_outputter(outputter)
  @outputters << outputter if outputter.respond_to?(:process)
end
clear_outputters() click to toggle source

Removes all outputters

# File lib/hallmonitor/dispatcher.rb, line 19
def self.clear_outputters
  @outputters = []
end
output(event) click to toggle source

Outputs an event via each registered outputter. If {Hallmonitor::Configuration} has the option `trap_outputter_exceptions` set to `true` then this method will trap and squash any errors raised by the outputter. @param event [Event] The event to output @return nil

# File lib/hallmonitor/dispatcher.rb, line 29
def self.output(event)
  @outputters.each do |o|
    begin
      o.process(event)
    rescue
      raise unless Hallmonitor.config && Hallmonitor.config.trap_outputter_exceptions
    end
  end
  nil
end
outputters() click to toggle source

Returns list of outputters registered @return [Array<Outputter>]

# File lib/hallmonitor/dispatcher.rb, line 7
def self.outputters
  @outputters
end