Just wanted to give a hint that it's not that hard to make it work.

Your approach is much cleaner and should be used of course.

Am Sonntag, 13. Januar 2013 13:00:50 UTC+1 schrieb Jordon Bedwell:
>
> On Sun, Jan 13, 2013 at 5:42 AM, Crispin Schäffler 
> <[email protected] <javascript:>> wrote: 
> > I don't really know that much about the interns of Rails.logger.error 
> method 
> > but how about overwriting it for your app? 
> > 
> > use alias on the old method and do something like this: 
> > alias :old_error :error 
> > 
> > def error 
> >    # send your mail or whatever 
> >    old_error 
> > end 
> > 
> > would at least do its job without braking all the stuff the logger does. 
>
> Uhm, you guys do know that you do not have to resort to such dirty 
> tactics?  Read: 
>
> Rails.logger.error do 
>   "There was an error".tap do |s| 
>     # Do mailing Work Here 
>   end 
> end 
>
> cat log/development.log 
> There was an error 
>

-- 
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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msg/rubyonrails-talk/-/Ao3o2brzhHUJ.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to