Sha256: 9b253149375d2d83a0ee27e0c636c64cde790281b7ca049a41b1ddb7096dccee

Contents?: true

Size: 549 Bytes

Versions: 12

Compression:

Stored size: 549 Bytes

Contents

module Hieracles
  class Notification
    attr_reader :level, :message, :timestamp, :source

    LEVEL = {
      'fatal' => 0,
      'error' => 1,
      'warning' => 2,
      'info' => 3,
      'debug' => 4
    }

    def initialize(source, message, level = 'info')
      @source = source
      @level = level
      @message = message
      @timestamp = Time.new
    end

    def to_hash
      {
        'source' => @source,
        'level' => @level,
        'message' => @message,
        'timestamp' => @timestamp
      }
    end

  end
end
    

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
hieracles-0.4.2 lib/hieracles/notification.rb
hieracles-0.4.1 lib/hieracles/notification.rb
hieracles-0.4.0 lib/hieracles/notification.rb
hieracles-0.3.6 lib/hieracles/notification.rb
hieracles-0.3.5 lib/hieracles/notification.rb
hieracles-0.3.4 lib/hieracles/notification.rb
hieracles-0.3.3 lib/hieracles/notification.rb
hieracles-0.3.2 lib/hieracles/notification.rb
hieracles-0.3.1 lib/hieracles/notification.rb
hieracles-0.3.0 lib/hieracles/notification.rb
hieracles-0.2.2 lib/hieracles/notification.rb
hieracles-0.2.1 lib/hieracles/notification.rb