From: Robert Dober Date: 2007-04-15T02:41:20+09:00 Subject: Re: RCR debug On 4/14/07, ara.t.howard@noaa.gov wrote: > On Sat, 14 Apr 2007, Tim Pease wrote: > > > On 4/13/07, Robert Dober wrote: > >> Tim the $DEBUG mechanism is quite primitive and other things are > >> needed for large scale development, no doubt. > >> My idea of the CR is orbiting around $DEBUG which is widely used in > >> quick hacks or small to medium scale development, but... > > > > A simple debug method seems like a great idea. But what happens when > > it ends up in Kernel and everyone starts using it? Now you'll get all > > the debug messages from your code and all the library code that you > > include. That's why I don't like the $DEBUG option. > > > > I know you want to put it into Kernel so everyone can use. But that's > > the whole problem -- everyone will start using it! And then it > > becomes not so useful. > > > > This is similar to making sure that your code runs -w clean (i.e. > > won't throw out warnings). The rails core is very bad about this -- > > lot's of warnings. Now you cannot find the warnings in your own code > > because all the rails warnings are cluttering things up. > > > > Same problem with a global $DEBUG flag. > > > > Just my $0.02 on the matter. > > > > Blessings, > > TwP > > > > PS Why not include this in the facets library? I think this would be > > a much more suitable place for such a creature. > > > > > > alternatively > > logger = Logger.new STDERR > logger.level = ENV['DEBUG_ENV_FOR_MY_CODE'] ? Logger::DEBUG : LOGGER::INFO > > logger.debug{ 'now you have a debug method that can be turned on/off from the environment' } > > it's prety kiss... > > -a > -- > be kind whenever possible... it is always possible. > - the dalai lama > > Ara I guess you are right about the Kernel, a standard library module/class might be better, voici Logger. Funnily I think I really have not done enough research about Logger after Tim's input, well maybe because Tim just explained that he prefered Logger and that was not on my mind. Sorry Tim if I was not thoughtful enough. I feel that I just wanted to facilitate a common pattern, I had not though a second about if that common pattern was worth being facilitated... ... probably it is not. Thanks for your input, I guess I'll call it an RCR ;). This is a great ML, they think for you, someone to write a solution for this weeks Ruby Quiz for me ? :))) Cheers Robert -- You see things; and you say Why? But I dream things that never were; and I say Why not? -- George Bernard Shaw