From a340f9e9ffea7c0b7a47e610e379d5f3c340ccc1 Mon Sep 17 00:00:00 2001 From: pvincent Date: Wed, 24 Jan 2024 11:47:38 +0400 Subject: [PATCH] refactor5 --- lib/formatters/basic_formatter.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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)