README.md in ratchetio-0.3.0 vs README.md in ratchetio-0.3.1

- old
+ new

@@ -30,34 +30,40 @@ ## Manually reporting exceptions and messages To report a caught exception to Ratchet, simply call `Ratchetio.report_exception`: - begin - foo = bar - rescue Exception => e - Ratchetio.report_exception(e) - end +```ruby +begin + foo = bar +rescue Exception => e + Ratchetio.report_exception(e) +end +``` If you're reporting an exception in the context of a request and are in a controller, you can pass along the same request and person context as the global exception handler, like so: - begin - foo = bar - rescue Exception => e - Ratchetio.report_exception(e, ratchetio_request_data, ratchetio_person_data) - end +```ruby +begin + foo = bar +rescue Exception => e + Ratchetio.report_exception(e, ratchetio_request_data, ratchetio_person_data) +end +``` You can also log individual messages: - # logs at the 'warning' level. all levels: debug, info, warning, error, critical - Ratchetio.report_message("Unexpected input", "warning") +```ruby +# logs at the 'warning' level. all levels: debug, info, warning, error, critical +Ratchetio.report_message("Unexpected input", "warning") - # default level is "info" - Ratchetio.report_message("Login successful") +# default level is "info" +Ratchetio.report_message("Login successful") - # can also include additional data as a hash in the final param - Ratchetio.report_message("Login successful", "info", :user => @user) +# can also include additional data as a hash in the final param +Ratchetio.report_message("Login successful", "info", :user => @user) +``` ## Person tracking Ratchet will send information about the current user (called a "person" in Ratchet parlance) along with each error report, when available. This works by trying the `current_user` and `current_member` controller methods. The return value should be an object with an `id` property and, optionally, `username` and `email` properties. @@ -66,9 +72,21 @@ ```ruby alias_method :my_user_method, :current_user helper_method :my_user_method ``` + + +## Exception level filters + +By default, all exceptions reported through `Ratchetio.report_exception()` are reporeted at the "error" level, except for the following, which are reported at "warning" level: + +- ActiveRecord::RecordNotFound +- AbstractController::ActionNotFound +- ActionController::RoutingError + +If you'd like to customize this list, see the example code in `config/initializers/ratchetio.rb`. Supported levels: "critical", "error", "warning", "info", "debug". + ## Help / Support If you run into any issues, please email me at brian@ratchet.io