package com.heyu.api.common;

import ch.qos.logback.classic.pattern.ClassicConverter;
import ch.qos.logback.classic.spi.ILoggingEvent;
import org.slf4j.MDC;

public class LogClassicConverter extends ClassicConverter {


    @Override
    public String convert(ILoggingEvent event) {
        String traceId = MDC.get("traceId");
        if (traceId != null) {
            StringBuffer sb = new StringBuffer();
            sb.append("[").append(traceId);
            sb.append("]");
            return sb.toString();
        }
        return "";
    }
}
