Sha256: c3304bc80a8cd899969ab73fe70c0902a4cda9fa912b3f682dd0da949050a0ca

Contents?: true

Size: 255 Bytes

Versions: 9

Compression:

Stored size: 255 Bytes

Contents

require "json"
fh = File.new(config[:file] || raise("must have filename"), 'a')
->(metric) {
  # TODO handle failed writes / disk full?
  fh.puts "#{Time.now.to_i} #{JSON.generate(metric)}"
  # TODO flush on timer / only log once per second?
  fh.flush
}

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
panoptimon-0.4.5 plugins/log_to_file/log_to_file.rb
panoptimon-0.4.4 plugins/log_to_file/log_to_file.rb
panoptimon-0.4.2 plugins/log_to_file/log_to_file.rb
panoptimon-0.4.1 plugins/log_to_file/log_to_file.rb
panoptimon-0.4.0 plugins/log_to_file/log_to_file.rb
panoptimon-0.3.0 plugins/log_to_file/log_to_file.rb
panoptimon-0.2.0 plugins/log_to_file/log_to_file.rb
panoptimon-0.1.0 plugins/log_to_file/log_to_file.rb
panoptimon-0.0.2 plugins/log_to_file/log_to_file.rb