Class: LogPorter::Event

Inherits:
Object
  • Object
show all
Defined in:
lib/logporter/event.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#hostnameObject

Returns the value of attribute hostname.



6
7
8
# File 'lib/logporter/event.rb', line 6

def hostname
  @hostname
end

#messageObject

Returns the value of attribute message.



7
8
9
# File 'lib/logporter/event.rb', line 7

def message
  @message
end

#priObject

Returns the value of attribute pri.



4
5
6
# File 'lib/logporter/event.rb', line 4

def pri
  @pri
end

#rawObject

Returns the value of attribute raw.



8
9
10
# File 'lib/logporter/event.rb', line 8

def raw
  @raw
end

#timestampObject

Returns the value of attribute timestamp.



5
6
7
# File 'lib/logporter/event.rb', line 5

def timestamp
  @timestamp
end

Instance Method Details

#time_iso8601Object

TODO(sissel): Should we include other source information like client address and port?



13
14
15
# File 'lib/logporter/event.rb', line 13

def time_iso8601
  return timestamp.strftime("%Y-%m-%dT%H:%M:%S.") + timestamp.tv_usec.to_s
end

#to_sObject



17
18
19
20
21
22
23
# File 'lib/logporter/event.rb', line 17

def to_s
  if @raw == true
    return message
  else
    return "<#{pri}>#{time_iso8601} #{hostname} #{message}"
  end
end