package com.njzscloud.supervisory.sys.log.utils;

import java.io.PrintWriter;
import java.io.StringWriter;

/**
 * @author Ljw
 */
public class ThrowableUtil {

    /**
     * 获取堆栈信息
     */
    public static String getStackTrace(Throwable throwable) {
        StringWriter sw = new StringWriter();
        try (PrintWriter pw = new PrintWriter(sw)) {
            throwable.printStackTrace(pw);
            return sw.toString();
        }
    }
}
