Class: Logrithm::Spitters::Exception
- Inherits:
-
Object
- Object
- Logrithm::Spitters::Exception
- Defined in:
- lib/logrithm/spitters/exception.rb
Constant Summary collapse
- BACKTRACE_LENGTH =
Logrithm::Log.option(:log, :backtrace, :len) || 8
Instance Method Summary collapse
- #formatted ⇒ Object
-
#initialize(e) ⇒ Exception
constructor
A new instance of Exception.
Constructor Details
#initialize(e) ⇒ Exception
Returns a new instance of Exception.
9 10 11 |
# File 'lib/logrithm/spitters/exception.rb', line 9 def initialize(e) @e = e.is_a?(::Exception) ? e : Wrapper.new(e.inspect) end |
Instance Method Details
#formatted ⇒ Object
13 14 15 16 17 18 19 20 21 22 |
# File 'lib/logrithm/spitters/exception.rb', line 13 def formatted formatted = format(@e) msg = [ "Error: #{formatted[:causes].map { |c| "⟨#{c.class}⟩ (“#{c.message}”)" }.join(' ⇐ ')}", formatted[:backtrace], "[#{formatted[:omitted]} more]".rjust(20, '.') ].join(joiner) Logrithm::Utils::Output.clrz(msg, Logrithm.color(:error).last) end |