2024-06-01 14:37:49 +08:00
|
|
|
package com.zhgd.config;
|
|
|
|
|
|
2024-06-04 16:02:14 +08:00
|
|
|
import com.WisdomSiteApplication;
|
2024-06-01 14:37:49 +08:00
|
|
|
import com.zhgd.xmgl.config.TaskAspect;
|
|
|
|
|
import com.zhgd.xmgl.constant.Cts;
|
|
|
|
|
import com.zhgd.xmgl.util.ThreadLocalUtil;
|
2024-06-04 16:02:14 +08:00
|
|
|
import lombok.extern.slf4j.Slf4j;
|
2024-06-01 14:37:49 +08:00
|
|
|
import org.apache.ibatis.logging.Log;
|
2024-06-04 16:02:14 +08:00
|
|
|
import org.springframework.boot.CommandLineRunner;
|
|
|
|
|
import org.springframework.stereotype.Component;
|
2024-06-01 14:37:49 +08:00
|
|
|
|
|
|
|
|
import java.util.Objects;
|
|
|
|
|
|
|
|
|
|
public class StdOutImplCustom implements Log {
|
|
|
|
|
|
|
|
|
|
public StdOutImplCustom(String clazz) {
|
|
|
|
|
// Do Nothing
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static Boolean isPrint() {
|
|
|
|
|
if (!Objects.equals(TaskAspect.onlyPrintInterface, 1)) {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
2024-06-04 16:02:14 +08:00
|
|
|
return WisdomSiteApplication.runSucess && Objects.equals(ThreadLocalUtil.getByKey(Cts.TL_IS_FROM_WEB, Boolean.class), true);
|
2024-06-01 14:37:49 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public boolean isDebugEnabled() {
|
|
|
|
|
return isPrint();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public boolean isTraceEnabled() {
|
|
|
|
|
return isPrint();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void error(String s, Throwable e) {
|
|
|
|
|
System.err.println(s);
|
|
|
|
|
e.printStackTrace(System.err);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void error(String s) {
|
|
|
|
|
System.err.println(s);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void debug(String s) {
|
|
|
|
|
if (isPrint()) {
|
|
|
|
|
System.out.println(s);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void trace(String s) {
|
|
|
|
|
if (isPrint()) {
|
|
|
|
|
System.out.println(s);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void warn(String s) {
|
|
|
|
|
System.out.println(s);
|
|
|
|
|
}
|
|
|
|
|
}
|