Sha256: 56c075ab2bbac61065418dcefaf5d1603ae6531f3b9b36d8ce336efe95b920fa

Contents?: true

Size: 573 Bytes

Versions: 6

Compression:

Stored size: 573 Bytes

Contents

require 'rubygems'
require File.dirname(__FILE__) + '/../tagged_logger'
require 'logger'

class TestLogDevice
  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")}
  puts "DEBUG: %s: %5.4f\n" % [name, (Time.now - start_time)]
end

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

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

measure_debug_time(std_logger, "Standard Logger")
measure_debug_time(logger, "Tagged Logger")

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
tagged_logger-0.4.5 test/test_performance.rb
tagged_logger-0.4.2 test/test_performance.rb
tagged_logger-0.4.0 test/test_performance.rb
tagged_logger-0.3.3 test/test_performance.rb
tagged_logger-0.3.2 test/test_performance.rb
tagged_logger-0.3.1 test/test_performance.rb