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
18:     def initialize(_name, hash={})
19:       super(_name, hash)
20:       @host = (hash[:hostname] or hash["hostname"])
21:       @port = (hash[:port] or hash["port"])
22: 
23:       begin 
24:         Logger.log_internal {
25:           "UDPOutputter will send to #{@host}:#{@port}"
26:         }
27:         @udpsock = UDPSocket.new
28:         @udpsock.connect( @host, @port )
29:       rescue Exception => e
30:         Logger.log_internal(ERROR) {
31:           "UDPOutputter failed to create UDP socket: #{e}"
32:         }
33:         Logger.log_internal {e}
34:         self.level = OFF
35:         raise e
36:       end
37:     end

Private Instance Methods

write(data) click to toggle source
    # File lib/log4r/outputter/udpoutputter.rb, line 43
43:     def write(data)
44:       @udpsock.send(data, 0)
45:     rescue Exception => e
46:       Logger.log_internal(ERROR) {
47:         "UDPOutputter failed to send data to #{@host}:#{@port}, #{e}"
48:       }
49:     end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.