Sha256: 17419c7e69554efaa18290c9e4d52c4e7cfd47658655aa4c8def4473726865bf

Contents?: true

Size: 482 Bytes

Versions: 6

Compression:

Stored size: 482 Bytes

Contents

module SyslogProto

  class Logger
    
    def initialize(hostname, facility)
      @packet = Packet.new
      @packet.hostname = hostname
      @packet.facility = facility
    end
    
    SEVERITIES.each do |k,v|
      define_method(k) do |*args|
        msg = args.shift
        raise ArgumentError.new "MSG may not be omitted" unless msg and msg.length > 0
        p = @packet.dup
        p.severity = k
        p.msg = msg
        p.assemble
      end
    end
    
  end

end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
errplane-0.3.7 lib/errplane/syslogproto/logger.rb
errplane-0.2.7 lib/errplane/syslogproto/logger.rb
errplane-0.2.6 lib/errplane/syslogproto/logger.rb
errplane-0.2.5 lib/errplane/syslogproto/logger.rb
errplane-0.2.4 lib/errplane/syslogproto/logger.rb
errplane-0.2.3 lib/errplane/syslogproto/logger.rb