Sha256: 5f5f778ba5dbe17c8e88f3df9efaee63e4b0fa45573a6f1a5ebefd509988b632

Contents?: true

Size: 431 Bytes

Versions: 7

Compression:

Stored size: 431 Bytes

Contents

module LogStats
  class Logger
    def self.info(config, message)
      return if !config[:verbose]
      puts(message)
    end

    def self.elapsed(config, message)
      if config[:verbose]
        start_at = Time.now
        print(message + '...')
        result = yield
        elapsed = ((Time.now - start_at) * 1000.0).round
        puts(" #{elapsed} ms")
        result
      else
        yield
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
log_stats-0.4.9 lib/log_stats/logger.rb
log_stats-0.4.8 lib/log_stats/logger.rb
log_stats-0.4.7 lib/log_stats/logger.rb
log_stats-0.4.6 lib/log_stats/logger.rb
log_stats-0.4.5 lib/log_stats/logger.rb
log_stats-0.4.4 lib/log_stats/logger.rb
log_stats-0.4.3 lib/log_stats/logger.rb