diff --git a/lib/formatters/basic_formatter.rb b/lib/formatters/basic_formatter.rb index 8a3a492..85473dc 100644 --- a/lib/formatters/basic_formatter.rb +++ b/lib/formatters/basic_formatter.rb @@ -94,10 +94,10 @@ class BasicFormatter < SemanticLogger::Formatters::Color # rubocop:disable Metri def exception return unless log.exception - backtrace = backtrace(log.exception) - - "#{ansi_wrap(log.exception.class, - ANSI_REVERSED_WARNING)} #{ansi_wrap(log.exception.message, ANSI_REVERSED_ERROR)}#{backtrace}" + clazz = log.exception.class + message = log.exception.message + stack = backtrace(log.exception) + "#{ansi_wrap(clazz, ANSI_REVERSED_WARNING)} #{ansi_wrap(message, ANSI_REVERSED_ERROR)}#{stack}" end def call(log, logger)