From: Pito Salas Date: 2009-07-21T23:50:50+09:00 Subject: Best practice question: logging I want to sprinkle my code (Ruby, not Rails) liberally with logging calls so that when things go wrong I can see what happened. - is Ruby's Logger class the best practice to use, or is there another that's cooler? For example it looks like Logger is not that flexible about changing the format of log entries. - Is it better to define a global $Logger variable to hold the new Logger object across classes and methods, or bettor to do a @l = Logger.new(STDOUT) in each class's initializer? - how do I minimize the overhead when logging is OFF? - is one of these idioms faster than the other: if debugging @l.debug("wow, what was that?" end @l.debug("wow, what was that?" if debugging @l.debug # no condition, just set @l.level = Logger::ERROR Any other tips or pointers would be greatly appreciated! Pito -- Posted via http://www.ruby-forum.com/.