Methods

Log4r::UDPOutputter

Attributes

host[R]
port[R]
udpsock[RW]

Public Class Methods

new(_name, hash={}) click to toggle source
# File lib/log4r/outputter/udpoutputter.rb, line 18
def initialize(_name, hash={})
  super(_name, hash)
  @host = (hash[:hostname] or hash["hostname"])
  @port = (hash[:port] or hash["port"])

  begin 
    Logger.log_internal {
      "UDPOutputter will send to #{@host}:#{@port}"
    }
    @udpsock = UDPSocket.new
    @udpsock.connect( @host, @port )
  rescue Exception => e
    Logger.log_internal(ERROR) {
      "UDPOutputter failed to create UDP socket: #{e}"
    }
    Logger.log_internal {e}
    self.level = OFF
    raise e
  end
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.