2015-10-21
- jennifer
- martym
| #!/bin/sh | |
| # ISC License | |
| # Copyright (c) 2026 Alexandre Gomes Gaigalas <alganet@gmail.com> | |
| # Permission to use, copy, modify, and/or distribute this software for any | |
| # purpose with or without fee is hereby granted, provided that the above | |
| # copyright notice and this permission notice appear in all copies. | |
| # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES |
| class ExampleController < ApplicationController | |
| rescue_from Exception, :with => :render_custom | |
| def render_custom(exception) | |
| if Exceptional::Remote.error(Exceptional::ExceptionData.new(exception, "Test Exception")) | |
| Rails.logger.info "Exceptional: #{exception.class} has been reported to Exceptional" | |
| else | |
| Rails.logger.error "Exceptional: Problem sending exception. Check your API key." | |
| end |
With Rails 3.0 released a few weeks ago I've migrated a few apps and I'm constantly finding useful new improvements. One such improvement is the ability to log anything in the same way that Rails internally logs ActiveRecord and ActionView. By default Rails 3 logs look slightly spiffier than those produced by Rails 2.3: (notice the second line has been cleaned up)
Started GET "/" for 127.0.0.1 at Mon Sep 06 01:07:11 -0400 2010
Processing by HomeController#index as HTML
User Load (0.2ms) SELECT `users`.* FROM `users` WHERE (`users`.`id` = 3) LIMIT 1
CACHE (0.0ms) SELECT `users`.* FROM `users` WHERE (`users`.`id` = 3) LIMIT 1
Rendered layouts/_nav.html.erb (363.4ms)