lib/logstasher/active_support/log_subscriber.rb in logstasher-2.1.2 vs lib/logstasher/active_support/log_subscriber.rb in logstasher-2.1.3
- old
+ new
@@ -84,13 +84,17 @@
def extract_exception(payload)
if payload[:exception]
exception, message = payload[:exception]
status = ::ActionDispatch::ExceptionWrapper.status_code_for_exception(exception)
backtrace = if LogStasher.backtrace
- $!.backtrace.join("\n")
- else
- $!.backtrace.first
- end
+ if LogStasher.backtrace_filter.respond_to?(:call)
+ LogStasher.backtrace_filter.call($!.backtrace).join("\n")
+ else
+ $!.backtrace.join("\n")
+ end
+ else
+ $!.backtrace.first
+ end
message = "#{exception}\n#{message}\n#{backtrace}"
{ status: status, error: message }
else
{}
end