On Mon, Apr 14, 2008 at 5:09 PM, TomRossi7
<tom-5bxIUPmzHicFraO2wh7vUA@public.gmane.org>
wrote:>
> Is there a simple way to customize logging so that when you call the
> logger method it includes the severity in the log? I just want to
> make it easy to find with something like a GREP.
>
> So a call to this:
> logger.warn(''my message'')
>
> Would put this in the log:
> WARNING: My message
http://wiki.rubyonrails.org/rails/pages/HowtoConfigureLogging
Just create a custom formatter and reference the log level there.
Something like the following, warning this has not been tested.
class Logger
def format_message(severity, timestamp, progname, msg)
"#{RAILS_DEFAULT_LOGGER.level} #{timestamp} (#{$$}) #{msg}\n"
end
end
Regards,
Michael Guterl
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---