@@ -83,6 +83,7 @@ final class Format {
8383 static final String NL = "\n " ;
8484 static final String ARRAY = "Array" ;
8585 public static final char SPACE = ' ' ;
86+ public static final String AT = "at " ;
8687
8788 static volatile int maxTagLength = MAX_TAG_LENGTH ;
8889 static volatile int beforeTagSpacesCount ;
@@ -815,7 +816,9 @@ static StringBuilder getFormattedMessage(StringBuilder stringBuilder, String mes
815816 static StringBuilder getFormattedThrowable (String message , Throwable throwable ) {
816817 String [] lines = null ;
817818 if (message != null ) {
818- lines = message .split ("\\ n" );
819+ lines = message .concat ("\n " + getThrowableMessage (throwable )).split ("\\ n" );
820+ } else {
821+ lines = getThrowableMessage (throwable ).split ("\\ n" );
819822 }
820823 int linesCount = getLinesCount (lines , throwable );
821824 lines = createLines (throwable , lines , linesCount );
@@ -833,6 +836,11 @@ static StringBuilder getFormattedThrowable(String message, Throwable throwable)
833836 return sb ;
834837 }
835838
839+ @ NonNull
840+ private static String getThrowableMessage (Throwable throwable ) {
841+ return throwable .getClass ().getName () + ": " + throwable .getMessage ();
842+ }
843+
836844 private static int getLinesCount (String title , String [] lines ) {
837845 int count = (lines == null ) ? 0 : lines .length ;
838846 if (Log .isLogOutlined ) {
@@ -900,9 +908,9 @@ private static String[] createLines(Throwable throwable, String[] lines, int cou
900908 StackTraceElement [] stack = throwable .getStackTrace ();
901909 for (int i = 0 ; i < stack .length ; i ++) {
902910 if (i == 0 ) {
903- lns [linesCount + 1 + i ] = THROWABLE_DELIMITER_START + stack [i ].toString ();
911+ lns [linesCount + 1 + i ] = THROWABLE_DELIMITER_START + AT + stack [i ].toString ();
904912 } else {
905- lns [linesCount + 1 + i ] = THROWABLE_DELIMITER_START + THROWABLE_DELIMITER_PREFIX + stack [i ].toString ();
913+ lns [linesCount + 1 + i ] = THROWABLE_DELIMITER_START + THROWABLE_DELIMITER_PREFIX + AT + stack [i ].toString ();
906914 }
907915 }
908916 }
@@ -965,7 +973,8 @@ static void addStackTrace(StringBuilder sb, Thread thread) {
965973 static void addStackTrace (StringBuilder sb , StackTraceElement [] traces ) {
966974 for (int i = 4 ; i < traces .length ; i ++) {
967975 sb .append (THROWABLE_DELIMITER_PREFIX );
968- sb .append (traces [i ].toString ());
976+ sb .append (AT );
977+ sb .append ( traces [i ].toString ());
969978 sb .append ('\n' );
970979 }
971980 }
0 commit comments