On Mon, Feb 2, 2009 at 11:08 PM, Nicholas Orr <[email protected]> wrote: > > As part of doing all that I want the actual error messages inside the > log file to be timestamped too :)
All this should be pretty simple. Just make a custom logger. That sounds complex but it isn't; you can write your own class that inherits from the Merb Logger class, and rewrite the << method so that it adds whatever you want to the string before calling 'super'. For an example in action go to http://railscasts.com and check out episode #56. Yeah, that's for Rails, but the concept isn't really different. Changing the destination of different logging levels would also be pretty easy; you'd just have to keep different streams open. Also read the Merb docs to tell you how to use the Logger::run() command to replace the current logger, and flush() and close() to shut off the logger so you can roll the log files as the original poster wanted. Or you could just make a logger class that proxies to either log4r or the Logger in the Ruby standard library, either of which support autorolling as a built-in feature. -- Have Fun, Steve Eley ([email protected]) ESCAPE POD - The Science Fiction Podcast Magazine http://www.escapepod.org --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "merb" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/merb?hl=en -~----------~----~----~----~------~----~------~--~---
