Created
December 2, 2022 12:51
-
-
Save prdanelli/7129a5281ec2b82bb03de59994b5c769 to your computer and use it in GitHub Desktop.
Log Extra data to Sentry
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def my_method | |
# ... | |
rescue NoMethodError => e | |
Sentry.with_scope do |scope| | |
scope.set_tags(foo: "bar") # <= Searchable tags | |
scope.set_context('Model Attributes', @local_instance_variable.attributes) # <= Logs extra hash of data | |
Sentry.capture_message("A test message") # <= Your custom message | |
Sentry.capture_error(e) # <= Log the error | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment