From: Brian Candler Date: 2003-08-02T01:12:52+09:00 Subject: Re: ANN: debugprint On Sat, Aug 02, 2003 at 12:51:02AM +0900, Michael Garriss wrote: > Very nice Brian. Can I use this code? Be my guest - I'm very happy to have someone else host it, maintain it, document it, and answer questions on it :-) I just thought of a little improvement: > > @logger_proc ||= proc { |str| $stderr.puts(str) } can become @logger_proc ||= DEFAULT_LOGGER_PROC with that constant defined earlier in the module. The nice thing about defining it as a module, is that you can still get global logging by including it at the top level: require '/path/to/logger' include Logger log "hello world" class Foo def initialize log "I am a new #{self.inspect}" end end Foo.new Foo.new This logger does what I need at the moment, but I imagine another nice feature would be to have multiple debug levels and be able to turn logging on or off for those levels. Regards, Brian.