From: Giuseppe Bilotta Date: Thu, 29 Jun 2006 22:56:08 +0000 (+0000) Subject: Add $stdout flushing to debug. This is needed to work around some 'laggy console... X-Git-Url: https://git.netwichtig.de/gitweb/?a=commitdiff_plain;h=1f834f996fcf3e9ead0e1a4adcdebafc5b52c82e;p=user%2Fhenk%2Fcode%2Fruby%2Frbot.git Add $stdout flushing to debug. This is needed to work around some 'laggy console' issues that may occur when using a tee program under Windows to copy the debug output to a file on disk --- diff --git a/lib/rbot/ircbot.rb b/lib/rbot/ircbot.rb index 76820bc9..8f0a2646 100644 --- a/lib/rbot/ircbot.rb +++ b/lib/rbot/ircbot.rb @@ -5,8 +5,11 @@ require 'fileutils' $debug = false unless $debug # print +message+ if debugging is enabled def debug(message=nil) - stamp = Time.now.strftime("%Y/%m/%d %H:%M:%S") - print "D: [#{stamp}] #{message}\n" if($debug && message) + if ($debug && message) + stamp = Time.now.strftime("%Y/%m/%d %H:%M:%S") + print "D: [#{stamp}] #{message}\n" + $stdout.flush + end #yield end