fix: replace printStackTrace/System.out.println with logger in JsHttpClient, PlaygroundApi, LogStatistics, CacheServiceImpl, JsPlaygroundExecutor, JsPlaygroundLogger

This commit is contained in:
yukaidi
2026-05-29 03:48:11 +08:00
parent 49a3918244
commit c4f94a2bc7
6 changed files with 16 additions and 10 deletions

View File

@@ -48,6 +48,6 @@ public class LogStatistics implements AfterInterceptor {
.execute(info)
.onSuccess(res -> {
log.info("inserted log: id={}, path={}, code={}", info.getId(), info.getPath(), info.getCode());
}).onFailure(Throwable::printStackTrace);
}).onFailure(e -> log.error("插入解析日志失败: id={}", info.getId(), e));
}
}

View File

@@ -704,6 +704,7 @@ public class PlaygroundApi {
if (throwable == null) {
return "";
}
log.error("获取异常堆栈信息", throwable);
java.io.StringWriter sw = new java.io.StringWriter();
java.io.PrintWriter pw = new java.io.PrintWriter(sw);
throwable.printStackTrace(pw);

View File

@@ -104,7 +104,7 @@ public class CacheServiceImpl implements CacheService {
promise.complete(result);
// 更新缓存
cacheManager.cacheShareLink(cacheLinkInfo);
cacheManager.updateTotalByField(cacheKey, CacheTotalField.API_PARSER_TOTAL).onFailure(Throwable::printStackTrace);
cacheManager.updateTotalByField(cacheKey, CacheTotalField.API_PARSER_TOTAL).onFailure(e -> log.error("更新API解析计数失败: cacheKey={}", cacheKey, e));
}).onFailure(promise::fail);
} else {
// 缓存命中,生成过期时间并生成下载命令
@@ -120,7 +120,7 @@ public class CacheServiceImpl implements CacheService {
promise.complete(result);
cacheManager.updateTotalByField(cacheKey, CacheTotalField.CACHE_HIT_TOTAL)
.onFailure(Throwable::printStackTrace);
.onFailure(e -> log.error("更新缓存命中计数失败: cacheKey={}", cacheKey, e));
}
}).onFailure(t -> promise.fail(t.fillInStackTrace()));