Sha256: 297c11f93b2bee07f46435e132ec17687428985f07d5d9f0bd1d651a83c5af32

Contents?: true

Size: 733 Bytes

Versions: 5

Compression:

Stored size: 733 Bytes

Contents

require File.join(File.dirname(__FILE__), '/test_helper')

class DummyTestLogDevice
  def write(msg); end
  def close; end  
  def clear; end
end

def measure_debug_time(a_logger, name)
  start_time = Time.now
  10_000.times { a_logger.debug("DEBUG")}
  diff = Time.now - start_time
  puts "Performance(10,000 logger.debug calls) for %s: %5.4f sec\n" % [name, diff]
  diff
end

std_logger = Logger.new(DummyTestLogDevice.new)
std_logger.level = Logger::INFO

TaggedLogger.rules do
  info /.*/, :to => std_logger
end

std_logger_time = measure_debug_time(std_logger, "Standard Logger")
tagged_logger_time = measure_debug_time(logger, "Tagged Logger")
puts "Tagger/Standard Logger speed = %2.2f" % (tagged_logger_time/std_logger_time)

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
tagged_logger-0.5.6 test/test_performance.rb
tagged_logger-0.5.5 test/test_performance.rb
tagged_logger-0.5.1 test/test_performance.rb
tagged_logger-0.5.0 test/test_performance.rb
tagged_logger-0.4.6 test/test_performance.rb