This post originated from an RSS feed registered with Ruby Buzz
by Daniel Berger.
Original Post: Compounding one error with another
Feed Title: Testing 1,2,3...
Feed URL: http://djberg96.livejournal.com/data/rss
Feed Description: A blog on Ruby and other stuff.
Zed Shaw went on a rant last night as a result of some code he found in the glue package, and rightfully so. Modifying a stock class in the stdlib is bad enough, but not even documenting the change is inexcusable.
The original issue seems to stem from the fact that the Logger class doesn't allow you to change the format of the message layout, except for the date/time format. Obviously, this is an issue that can and should be resolved in the Logger class itself via a patch to NaHi. Even if you can't wait for a patch the solution is, as Zed suggests, to subclass and deal with it in your own class. You do NOT screw with the existing class, precisely because it might cause side effects. Just the sort of side effects that Zed ran into.
As we speak I'm pouring over the logger.rb file, adding Nicholas Seckar's proposed change, and tweaking a few other things as I go. Nothing too radical, though I am going to propose a "Log" toplevel namespace for this and most of the other logging packages.
Anyway, a big slap on the wrist for the glue authors. No cookie for you.