Skip to content

Commit

Permalink
Merge pull request #1915 from okkez/human-readable-event-time
Browse files Browse the repository at this point in the history
Define Fluent::EventTime#inspect method
  • Loading branch information
repeatedly authored Apr 2, 2018
2 parents 39d6911 + 9db478b commit 095bf17
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/fluent/time.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
module Fluent
class EventTime
TYPE = 0
FORMATTER = Strftime.new('%Y-%m-%d %H:%M:%S.%N %z')

def initialize(sec, nsec = 0)
@sec = sec
Expand Down Expand Up @@ -108,6 +109,10 @@ def self.parse(*args)
def method_missing(name, *args, &block)
@sec.send(name, *args, &block)
end

def inspect
FORMATTER.exec(Time.at(self))
end
end

module TimeMixin
Expand Down

0 comments on commit 095bf17

Please sign in to comment.