From 29f6ef0f1a2c158569f42336aba814439f49ab22 Mon Sep 17 00:00:00 2001 From: Taylor Lodge Date: Wed, 4 Oct 2017 11:23:40 +1300 Subject: [PATCH] Update README.md --- README.md | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 61238c9..f08bdd2 100644 --- a/README.md +++ b/README.md @@ -193,13 +193,11 @@ end Custom data can be added to `track_exception` by passing a custom_data key in the second parameter hash. ```ruby - begin # more lovely code rescue Exception => e Raygun.track_exception(e, custom_data: {my: 'custom data', goes: 'here'}) end - ``` Custom data can also be specified globally either by setting `config.custom_data` to a hash @@ -321,8 +319,17 @@ end ### Tags -Raygun allows you to tag error reports with any number of tags. In your Raygun.setup block, set `tags` to an array of strings to have those -set on any error reports sent by the gem. +Tags can be added to `track_exception` by passing a tags key in the second parameter hash. + +```ruby +begin + # more lovely code +rescue Exception => e + Raygun.track_exception(e, tags: ['my', 'tags', 'go here') +end +``` + +Tags can also be specified globally either by setting `config.custom_data` to an array ```ruby Raygun.setup do |config| @@ -330,6 +337,17 @@ Raygun.setup do |config| end ``` +or to a proc, which gets passed the exception and environment hash. This proc _must_ return an array of strings + +```ruby +Raygun.setup do |config| + config.api_key = "YOUR_RAYGUN_API_KEY" + config.tags do |e, env| + [env["SERVER_NAME"]] + end +end +``` + ### Resque Error Tracking Raygun4Ruby also includes a Resque failure backend. You should include it inside your Resque initializer (usually something like `config/initializers/load_resque.rb`)