Sha256: 3965c91877325c4b721842e79e249791c77e66df160588be4e59e2a689f02c18

Contents?: true

Size: 575 Bytes

Versions: 8

Compression:

Stored size: 575 Bytes

Contents

module Vitals::Reporters
  class ConsoleReporter < BaseReporter
    attr_accessor :format

    def initialize(category:'main', output: $stdout, format:nil)
      @format = format
      @category = category
      @output = output
    end

    def inc(m)
      print "#{@category} INC #{self.format.format(m)}"
    end

    def gauge(m, v)
      print "#{@category} GAUGE #{self.format.format(m)} #{v}"
    end

    def timing(m, v)
      print "#{@category} TIME #{self.format.format(m)} #{v}"
    end

    def print(str)
      @output.printf("#{ str }\n")
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
vitals-0.9.1 lib/vitals/reporters/console_reporter.rb
vitals-0.9.0 lib/vitals/reporters/console_reporter.rb
vitals-0.8.1 lib/vitals/reporters/console_reporter.rb
vitals-0.8.0 lib/vitals/reporters/console_reporter.rb
vitals-0.7.0 lib/vitals/reporters/console_reporter.rb
vitals-0.6.0 lib/vitals/reporters/console_reporter.rb
vitals-0.5.0 lib/vitals/reporters/console_reporter.rb
vitals-0.4.0 lib/vitals/reporters/console_reporter.rb