class Observed::BuiltinPlugins::File

Constants

UNDEFINED

Public Instance Methods

report(tag, time, data) click to toggle source

@param [String] tag @param [Time] time @param [Hash] data

# File lib/observed/builtin_plugins/file.rb, line 21
def report(tag, time, data)
  formatted_data = format_report(tag, time, data)
  mode = case self.mode
         when :append, 'a'
           'a'
         when :overwrite, 'w'
           'w'
         else
           fail "Unsupported value for the parameter `:mode`: Supported values are :append, :overwrite, " +
                    "'a', 'w'. The specified value is #{self.mode.inspect}"
         end
  ::File.open(path, mode) do |f|
    f.puts formatted_data
  end
end