Class: Djb::Daemontools::Multilog::Log
- Inherits:
-
Object
- Object
- Djb::Daemontools::Multilog::Log
- Defined in:
- lib/djb/daemontools/multilog/log.rb
Instance Attribute Summary collapse
-
#time ⇒ Object
Returns the value of attribute time.
Instance Method Summary collapse
-
#initialize(line, service) ⇒ Log
constructor
A new instance of Log.
- #tai64n ⇒ Object
- #to_s ⇒ Object
- #to_time ⇒ Object
Constructor Details
#initialize(line, service) ⇒ Log
Returns a new instance of Log.
10 11 12 13 14 |
# File 'lib/djb/daemontools/multilog/log.rb', line 10 def initialize(line,service) @line = line @time = to_time @service = service end |
Instance Attribute Details
#time ⇒ Object
Returns the value of attribute time.
8 9 10 |
# File 'lib/djb/daemontools/multilog/log.rb', line 8 def time @time end |
Instance Method Details
#tai64n ⇒ Object
16 17 18 |
# File 'lib/djb/daemontools/multilog/log.rb', line 16 def tai64n return $1 if /^(@[a-z0-9]+) / =~ @line end |
#to_s ⇒ Object
24 25 26 27 28 |
# File 'lib/djb/daemontools/multilog/log.rb', line 24 def to_s if /^(@[a-z0-9]+) (.*)/ =~ @line "%s [%s] %s" % [time.strftime("%Y-%m-%d %H:%M:%S"),@service,$2] end end |