From: Suraj Kurapati Date: 2008-06-24T05:59:50+09:00 Subject: Re: Is it ellegant to use a global variable to store a Logger object? ara.t.howard wrote: > this is a bad idea. try to use rails' code with other code that uses > ruby's logging class and you'll see what i mean. Perhaps they modify ruby's logging class directly? I am proposing something different: a selective injection of logging functionality into a library's top-level module. > it's better just to keep things simple imho I agree, but keep what simple? Implementation or interface? I単aki seems to want the interface to be simple, i.e. an automatic logging facility that is (1) private to his library and (2) does not require any explicit enabling (include Logging) or addressing (a LOG constant). > your meta-programming bit will fail, for example, if someone does > > module M > extend AddLoggingToNested > end That is easily solved by aliasing included() to extended(): module AddLoggingToNested # ... code from previous email ... class << self alias extended included end end -- Posted via http://www.ruby-forum.com/.