You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CHANGELOG.md
+6Lines changed: 6 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,9 +1,15 @@
1
+
## 2.1.0
2
+
3
+
Features
4
+
- Ability to record breadcrumbs in your code that will be sent to Raygun along with a raised exception ([#113](https://github.com/MindscapeHQ/raygun4ruby/pull/113))
5
+
1
6
## 2.0.0 (20/04/2017)
2
7
3
8
Bugfixes:
4
9
- Fix broken handling of raw request body reading in Rack applications ([#116](https://github.com/MindscapeHQ/raygun4ruby/pull/116))
5
10
- This is a breaking change to how raw data was being read before so it requires a major version bump
6
11
- Raw request data reading is now disabled by default and can be enabled via the `record_raw_data` configuration option
Copy file name to clipboardExpand all lines: README.md
+43Lines changed: 43 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -98,6 +98,49 @@ Raygun.setup do |config|
98
98
end
99
99
```
100
100
101
+
### Recording Breadcrumbs
102
+
103
+
Breadcrumbs let you provide logging points in your code that will be collected and sent along with any exception sent to Raygun. This lets you have a better understanding of the events that happened in the system that lead up to the exception.
104
+
105
+
1. Include it as a module in your class
106
+
```ruby
107
+
classSomeClass
108
+
includeRaygun::Breadcrumbs
109
+
110
+
defsome_method
111
+
record_breadcrumb(
112
+
message:"<log message goes here>",
113
+
category:"some category to group them by, maybe authentication or external-apis for example",
114
+
level::info, # or debug or warning etc, you can configure what level will get sent
115
+
metadata: {custom_data:'can go here'},
116
+
)
117
+
end
118
+
end
119
+
```
120
+
This has the added benefit of recording the class the breadcrumb was recorded from automatically
121
+
122
+
2. Call the `record_breadcrumb` method manually
123
+
```ruby
124
+
defsome_method
125
+
Raygun.record_breadcrumb(
126
+
message:"<log message goes here>",
127
+
category:"some category to group them by, maybe authentication or external-apis for example",
128
+
level::info, # or debug or warning etc, you can configure what level will get sent
129
+
metadata: {custom_data:'can go here'},
130
+
131
+
# You can also set the class the breadcrumb was logged from
132
+
# It will only be set automatically using the included module approach
133
+
# Method and line number will get added automatically
134
+
class_name:self.class.name
135
+
)
136
+
end
137
+
```
138
+
139
+
If you are using Sinatra or another rack framework you will need to include the Breadcrumbs middleware, this is used for storing the breadcrumbs during a request
If you are using a non web based Ruby application you will have to call `Raygun::Breadcrumbs::Store.initialize` during your applications boot process. The store is per thread, but I have not tested it in a multi threaded application.
143
+
101
144
### Filtering the payload by whitelist
102
145
103
146
As an alternative to the above, you can also opt-in to the keys/values to be sent to Raygun by providing a specific whitelist of the keys you want to transmit.
Raygun.log("[Raygun.breadcrumbs] discarding breadcrumb because #{crumb.level} is below active breadcrumb level (#{Raygun.configuration.breadcrumb_level})")
Raygun.log("[Raygun.configuration] unknown breadcrumb level: #{value} not setting")
157
+
end
158
+
end
159
+
147
160
defaffected_user_identifier_methods
148
161
Raygun.deprecation_warning("Please note: You should now user config.affected_user_method_mapping.Identifier instead of config.affected_user_identifier_methods")
0 commit comments