Sha256: da2afab3069ddde3b50b9aebbe77110f29e3fb0d70b1c47511eea5a01713ae8e
Contents?: true
Size: 937 Bytes
Versions: 1
Compression:
Stored size: 937 Bytes
Contents
require 'woodchuck/logger' class Woodchuck::Event attr_accessor :path, :line, :host, :timestamp, :source, :message, :fields, :tags def initialize(path, line) @path = path @line = line @host = Socket.gethostname @timestamp = Time.now.utc.iso8601(6) @source = Addressable::URI.new(:scheme => 'file', :host => host, :path => path) @message = line.strip @fields = {} @tags = [] end def method_missing(symbol, *args, &block) if to_hash.has_key?(symbol) to_hash else super(symbol, *args, &block) end end def to_hash { '@source' => source.to_s, '@type' => source.scheme, '@tags' => tags, '@fields' => fields, '@timestamp' => timestamp, '@source_host' => host, '@source_path' => path, '@message' => message } end def to_json(*args) to_hash.to_json(*args) end def to_s to_json end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
woodchuck-0.0.1 | lib/woodchuck/event.rb |