Skip to content

Instantly share code, notes, and snippets.

@eric
Created October 25, 2009 02:15
Show Gist options
  • Save eric/217843 to your computer and use it in GitHub Desktop.
Save eric/217843 to your computer and use it in GitHub Desktop.
$:.unshift "#{File.dirname(__FILE__)}/lib"
require 'ostruct'
require 'god'
God::Logger.syslog = false
templogio = StringIO.new
templogger = God::SimpleLogger.new(templogio)
null_logger = God::SimpleLogger.new(File.open('/dev/null', 'w'))
letters = ('a'..'z').to_a.freeze
old_stdout = $stdout.dup
$stdout.reopen(File.open('/dev/null', 'w'))
w = OpenStruct.new(:name => 'one')
loop do
10000.times do |i|
letters.each do |letter|
str = letter * i
# test 1:
#LOG.log(w, :info, str)
# test 2:
# templogio.truncate(0)
# templogio.rewind
# templogger.send(:info, str)
# test 3:
null_logger.send(:info, str)
end
end
$stderr.puts "memory: #{God::System::Process.new(Process.pid).memory}"
LOG.logs.each do |k,v|
$stderr.puts "logs: #{k}: #{v.size}"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment