Use captureException for sentry

We already get an exception and backtrace, but there's no
well-documented way to add this to an event, so I suggest to use
captureException instead.

https://community.openproject.org/wp/39012
pull/9735/head
Oliver Günther 3 years ago
parent a619360f4c
commit 42c5252d49
  1. 7
      lib/open_project/logging/sentry_logger.rb

@ -7,7 +7,12 @@ module OpenProject
def log(message, log_context = {})
Sentry.configure_scope do |sentry_scope|
build_sentry_context(sentry_scope, log_context.to_h)
Sentry.capture_message(message, level: sentry_level(log_context[:level]))
if log_context[:exception]
Sentry.capture_exception(log_context[:exception])
else
Sentry.capture_message(message, level: sentry_level(log_context[:level]))
end
end
end

Loading…
Cancel
Save