Method: Mongo::Utils.excerpt_backtrace

Defined in:
lib/mongo/utils.rb

.excerpt_backtrace(exc, **opts) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Options Hash (**opts):

  • :bg_error_backtrace (true | false | nil | Integer)

    Experimental. Set to true to log complete backtraces for errors in background threads. Set to false or nil to not log backtraces. Provide a positive integer to log up to that many backtrace lines.



50
51
52
53
54
55
56
57
58
59
# File 'lib/mongo/utils.rb', line 50

module_function def excerpt_backtrace(exc, **opts)
  case lines = opts[:bg_error_backtrace]
  when Integer
    ":\n#{exc.backtrace[0..lines].join("\n")}"
  when false, nil
    nil
  else
    ":\n#{exc.backtrace.join("\n")}"
  end
end