Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add sentry for exception logging #8

Merged
merged 3 commits into from
Aug 8, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ gem 'uglifier', '>= 1.0.3'
gem 'byebug', '~>11.0.1'
gem 'puma', '~> 4.0.1'
gem 'twitter', '~> 6.2.0'
gem 'sentry-raven', '~> 2.11'
#gem 'jquery-rails'
gem "devise", "~> 4.6.2"
gem "omniauth", "~>1.9.0"
Expand Down
7 changes: 6 additions & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,15 @@ GEM
erubi (1.8.0)
erubis (2.7.0)
execjs (2.7.0)
faraday (0.15.4)
multipart-post (>= 1.2, < 3)
ffi (1.11.1)
formtastic (3.1.5)
actionpack (>= 3.2.13)
formtastic_i18n (0.6.0)
globalid (0.4.2)
activesupport (>= 4.2.0)
haml (5.1.1)
haml (5.1.2)
temple (>= 0.8.0)
tilt
haml-rails (2.0.1)
Expand Down Expand Up @@ -244,6 +246,8 @@ GEM
sprockets (> 3.0)
sprockets-rails
tilt
sentry-raven (2.11.0)
faraday (>= 0.7.6, < 1.0)
sexp_processor (4.12.1)
simple_oauth (0.3.1)
sprockets (3.7.2)
Expand Down Expand Up @@ -310,6 +314,7 @@ DEPENDENCIES
pygmentize (~> 0.0.3)
rails (= 5.2.3)
redcarpet (~> 1.17.2)
sentry-raven (~> 2.11)
twitter (~> 6.2.0)
twitter-bootstrap-rails (~> 4.0.0)
uglifier (>= 1.0.3)
Expand Down
7 changes: 7 additions & 0 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
class ApplicationController < ActionController::Base
protect_from_forgery
before_action :set_raven_context

private
def set_raven_context
Raven.user_context(id: session[:current_user_id])
Raven.extra_context(params: params.to_unsafe_h, url: request.url)
end
end

4 changes: 4 additions & 0 deletions config/initializers/sentry.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Raven.configure do |config|
config.dsn = ENV['SENTRY_DSN']
config.sanitize_fields = Rails.application.config.filter_parameters.map(&:to_s)
end