Format a throwable using default throwable formatter.

@param throwable the throwable to format
@return the formatted string
964328
public static String formatThrowable(Throwable throwable) {
    assertInitialization();
    return XLog.sLogConfiguration.throwableFormatter.format(throwable);
  }
970887
public String format(String clientID, String name, long time, Level level, Object message,
	        Throwable t){

		if (!patternParsed && pattern != null) {
			parsePattern(pattern);
		}

		StringBuffer formattedStringBuffer = new StringBuffer(64);
		if (commandArray != null) {
			int length = commandArray.length;

			for (int index = 0; index < length; index++) {
				FormatCommandInterface currentConverter = commandArray[index];
				if (currentConverter != null) {
					formattedStringBuffer.append(currentConverter.execute(clientID, name, time,
					        level, message, t));
				}
			}
		}

		return formattedStringBuffer.toString();
	}
773803
private String format(String message, Object[] params) {
        if (params.length == 0) {
            return message;
        } else if (params.length == 1 && params[0] instanceof Throwable) {
            // We print only the message here since breaking exception will bubble up
            // anyway
            return message + ": " + params[0].toString();
        } else {
            return String.format(message, params);
        }
    }
745342
public static String getInitialCauseMessage(final Throwable throwable) {
        final Throwable cause = getInitialCause(throwable);
        if (cause.getLocalizedMessage() == null) {
            return cause.getClass().getSimpleName();
        }
        return cause.getLocalizedMessage();
    }
1180630
@Override
    protected String convertToString(Object value) throws Throwable {
		Link link = (Link) value;
		return link.getValue();
    }
576528
public static String getExceptionMessage(List throwables)
    {
        if (throwables == null)
        {
            return null;
        }

        for (int i = throwables.size()-1; i>0; i--)
        {
            Throwable t = (Throwable) throwables.get(i);
            if (t.getMessage() != null)
            {
                return t.getMessage();
            }
        }
        
        return null;
    }
231584
public String format(Iterable<?> iterable) {
    if (iterable == null) {
      return StringUtils.EMPTY;
    }
    return format(iterable.iterator());
  }
227369
public static String formatObjectToString(Object objData)
    {
        if (objData == null)
            return null;
        try {
            return Converter.formatObjectToString(objData, objData.getClass(), null);
        } catch (Exception ex) {
            return null;
        }
    }
44764
private static function serializeThrowableObject($throwable): string
    {
        $message = \sprintf(
            '[GraphQL] %s: %s[%d] (caught throwable) at %s line %s.',
            \get_class($throwable),
            $throwable->getMessage(),
            $throwable->getCode(),
            $throwable->getFile(),
            $throwable->getLine()
        );

        return $message;
    }
394438
public static <V> Callable<V> wrap(final Callable<V> callable) {
		final String suffix = Log.suffix.get();
		// t.getCause() is atop t, see Log.concat() for more details
		final Throwable t = new Throwable(Log.throwable.get());
		return new Callable<V>() {
			@Override
			public V call() throws Exception {
				threadNum.incrementAndGet();
				Log.suffix.set(suffix);
				Log.throwable.set(t);
				try {
					return callable.call();
				} catch (Error e) {
					throw new Exception(e);
				} finally {
					Log.throwable.remove();
					Log.suffix.remove();
					threadNum.decrementAndGet();
				}
			}
		};
	}
1250211
public static String throwableToString(Throwable t)
	{
		StringWriter s = new StringWriter();
		PrintWriter p = new PrintWriter(s);
		t.printStackTrace(p);
		return s.toString();
	}
278340
public static void debug(final Throwable throwable) {
        final StringWriter errors = new StringWriter();
        throwable.printStackTrace(new PrintWriter(errors));
        debugLogger.accept(errors.toString());
    }
460082
public static String printExceptionWithStackInfo(Throwable throwable) {
        StringBuilder out = new StringBuilder();
        printExceptionWithStackInfo(throwable, out);
        return out.toString();
    }
1175643
private String generateAbbreviatedExceptionMessage(final Throwable throwable) {

		final StringBuilder builder = new StringBuilder();
		builder.append(": ");
		builder.append(throwable.getClass().getCanonicalName());
		builder.append(": ");
		builder.append(throwable.getMessage());

		Throwable cause = throwable.getCause();
		while (cause != null) {
			builder.append('\n');
			builder.append("Caused by: ");
			builder.append(cause.getClass().getCanonicalName());
			builder.append(": ");
			builder.append(cause.getMessage());
			// make sure the exception cause is not itself to prevent infinite
			// looping
			assert (cause != cause.getCause());
			cause = (cause == cause.getCause() ? null : cause.getCause());
		}
		return builder.toString();
	}
90296
private String format(final String pattern, final Object argument) {
		try {
			return getFormatter(pattern, argument).format(argument);
		} catch (IllegalArgumentException ex) {
			InternalLogger.log(Level.WARN, "Illegal argument '" + String.valueOf(argument) + "' for pattern '" + pattern + "'");
			return String.valueOf(argument);
		}
	}
936125
public static List<Throwable> getCausalChain(final Throwable throwable) {
		if (throwable == null) {
			throw new NullPointerException("Throwable is null");
		}
		
		List<Throwable> causes = new ArrayList<Throwable>();
		causes.add(throwable);
		
		Throwable cause = throwable.getCause();
		
		while ((cause != null) && (!causes.contains(cause))) {
			causes.add(cause);
			cause = cause.getCause();
		}
		
		return causes;
	}
425728
public static RuntimeException wrap(Throwable throwable) {
        RuntimeException result;
        if (throwable instanceof RuntimeException) {
            result = (RuntimeException) throwable;
        } else {
            result = new RuntimeException(throwable.getClass().getSimpleName(), throwable);
        }
        return result;
    }