Class: Cogger::Formatters::Crash
- Inherits:
-
Object
- Object
- Cogger::Formatters::Crash
- Defined in:
- lib/cogger/formatters/crash.rb
Overview
Formats fatal crashes.
Constant Summary collapse
- TEMPLATE =
<<~CONTENT <dynamic>[%<id>s] [%<level>s] [%<at>s] Crash! %<message>s %<error_message>s (%<error_class>s) %<backtrace>s</dynamic> CONTENT
Instance Method Summary collapse
- #call(*input) ⇒ Object
-
#initialize(template = TEMPLATE, processor: Processors::Color.new) ⇒ Crash
constructor
A new instance of Crash.
Constructor Details
#initialize(template = TEMPLATE, processor: Processors::Color.new) ⇒ Crash
Returns a new instance of Crash.
14 15 16 17 |
# File 'lib/cogger/formatters/crash.rb', line 14 def initialize template = TEMPLATE, processor: Processors::Color.new @template = template @processor = processor end |
Instance Method Details
#call(*input) ⇒ Object
19 20 21 22 23 |
# File 'lib/cogger/formatters/crash.rb', line 19 def call(*input) updated_template, attributes = processor.call(template, *input) attributes[:backtrace] = %( #{attributes[:backtrace].join "\n "}) "#{format(updated_template, **attributes)}\n" end |