Sha256: 1e289179a520e607ff3d849aae0bd21ade2c28f3a5f7450678b4df42cbdc2ca5
Contents?: true
Size: 536 Bytes
Versions: 2
Compression:
Stored size: 536 Bytes
Contents
module ItamaeMitsurin module Handler class Json < Base def initialize(*) super require 'time' open_file end def event(type, payload = {}) super @f.puts({'time' => Time.now.iso8601, 'event' => type, 'payload' => payload}.to_json) end private def open_file logs_path = @options.values.join @options={"path" => "#{logs_path + '.' + Time.now.strftime("%Y%m%d")}"} @f = open(@options.fetch('path'), 'a') end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
itamae-mitsurin-0.24 | lib/itamae-mitsurin/handler/json.rb |
itamae-mitsurin-0.23 | lib/itamae-mitsurin/handler/json.rb |