Sha256: d896d822b317b9bbe33d2cbaf0f68836074e028a37a980388d7064bb93ef1223
Contents?: true
Size: 502 Bytes
Versions: 4
Compression:
Stored size: 502 Bytes
Contents
module Salus class StdoutRenderer < BaseRenderer def initialize(opts={}) super(opts) @precision = opts.fetch(:precision, 2) end def render(data) iterate(data) do |name, metric| value = metric.value unless metric.is_a?(Salus::Text) value = "%.#{@precision}f" % value unless value.nil? end STDOUT.puts "[#{Time.at(metric.timestamp)}] #{name} - #{value}" unless metric.timestamp.nil? end end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
salus-0.2.1 | lib/salus/renderer/stdout.rb |
salus-0.2.0 | lib/salus/renderer/stdout.rb |
salus-0.1.3 | lib/salus/renderer/stdout.rb |
salus-0.1.2 | lib/salus/renderer/stdout.rb |