Hi All,

I intend to use Needle in my future Ruby and RoR development,  so I
want to got through it tutorial at
http://needle.rubyforge.org/chapter-1.html in detail.

Following is a test of the first example.  It works great except for
one anomaly:  There is an output line with "nil" between the two debug
line surround the "real" body of the method.  What could be the cause
of it?

Thanks in advance,
Richard

========= Test.rb ==========
# http://needle.rubyforge.org/chapter-1.html
# Log method without 'Nails'
# Class Logger: http://www.ruby-doc.org/core/classes/Logger.html

require "logger.rb" # (In
K:\_Utilities\Ruby_1.8.2-15\ruby\lib\ruby\1.8)

def foo( arg1, arg2 )
  @log = Logger.new(STDOUT)
  @log.level = Logger::DEBUG
  @log.debug("Created logger")

@log.debug( "in foo with #{arg1} and #{arg2}" ) if @log.debug?
  result = arg1 + arg2  # The "real" body of the method "foo"
@log.debug( "finishing foo with #{result}" ) if @log.debug

  return result

rescue Exception => e
  @log.debug( "foo raised exception #{e.message} (#{e.class})" ) if
@log.debug?
  raise
end

foo(1,2)

===== Output =======
D, [2006-11-30T22:46:41.609000 #280] DEBUG -- : Created logger
D, [2006-11-30T22:46:41.609000 #280] DEBUG -- : in foo with 1 and 2
D, [2006-11-30T22:46:41.609000 #280] DEBUG -- : nil
D, [2006-11-30T22:46:41.609000 #280] DEBUG -- : finishing foo with 3