1010import lombok .Getter ;
1111import lombok .extern .slf4j .Slf4j ;
1212import okhttp3 .*;
13- import okhttp3 .extension .logging .HttpLogLevel ;
1413
1514import java .io .IOException ;
1615import java .util .Map ;
@@ -83,7 +82,7 @@ private OpenClawHttpClient(OpenClawHttpClientConfig config, ObjectMapper objectM
8382 this .objectMapper = objectMapper != null ? objectMapper : createObjectMapper ();
8483 this .httpClient = Objects .requireNonNull (httpClient , "httpClient" );
8584 this .ownsHttpClient = ownsHttpClient ;
86- debug (HttpLogLevel . BASIC , "OpenClaw HTTP client initialized: baseUrl={}, connectTimeoutMs={}, readTimeoutMs={}, "
85+ debug (" BASIC" , "OpenClaw HTTP client initialized: baseUrl={}, connectTimeoutMs={}, readTimeoutMs={}, "
8786 + "callTimeoutMs={}, retryOnConnectionFailure={}, debugLevel={}" ,
8887 config .getBaseUrl (), config .getConnectTimeoutMillis (), config .getReadTimeoutMillis (),
8988 config .getCallTimeoutMillis (), config .isRetryOnConnectionFailure (),
@@ -139,7 +138,7 @@ protected Request.Builder authedBuilder(String url, Map<String, String> headers)
139138 headers .forEach ((k , v ) -> {
140139 if (k != null && v != null ) {
141140 builder .header (k , v );
142- debug (HttpLogLevel . HEADERS , "Added header: {}={}" , k , redactHeader (k , v ));
141+ debug (" HEADERS" , "Added header: {}={}" , k , redactHeader (k , v ));
143142 }
144143 });
145144 }
@@ -200,7 +199,7 @@ protected CompletableFuture<String> postJsonAsync(String path, Object body, Map<
200199
201200 try {
202201 String json = objectMapper .writeValueAsString (body );
203- debug (HttpLogLevel . BODY , "Request body: {}" , truncate (json ));
202+ debug (" BODY" , "Request body: {}" , truncate (json ));
204203
205204 Request request = authedBuilder (url , headers )
206205 .post (RequestBody .create (json , JSON ))
@@ -281,9 +280,9 @@ protected CompletableFuture<String> executeAsync(Request request, String url,
281280 HttpCallCancellation cancellation ) {
282281 long requestId = REQUEST_SEQUENCE .incrementAndGet ();
283282 long startedAt = System .nanoTime ();
284- debug (HttpLogLevel . BASIC , "HTTP request started: requestId={}, method={}, url={}" ,
283+ debug (" BASIC" , "HTTP request started: requestId={}, method={}, url={}" ,
285284 requestId , request .method (), request .url ());
286- debug (HttpLogLevel . HEADERS , "HTTP request headers: requestId={}, headers={}" ,
285+ debug (" HEADERS" , "HTTP request headers: requestId={}, headers={}" ,
287286 requestId , redactHeaders (request .headers ()));
288287
289288 // 传输层只读取状态码和响应体;此处统一把非 2xx 响应转换为携带诊断信息的 SDK 异常。
@@ -300,9 +299,9 @@ protected CompletableFuture<String> executeAsync(Request request, String url,
300299 requestId , request .method (), request .url (), elapsedMillis (startedAt ), unwrap (error ).getMessage ());
301300 return ;
302301 }
303- debug (HttpLogLevel . BASIC , "HTTP request completed: requestId={}, method={}, url={}, bodyLength={}, elapsedMs={}" ,
302+ debug (" BASIC" , "HTTP request completed: requestId={}, method={}, url={}, bodyLength={}, elapsedMs={}" ,
304303 requestId , request .method (), request .url (), respBody .length (), elapsedMillis (startedAt ));
305- debug (HttpLogLevel . BODY , "HTTP response body: requestId={}, body={}" , requestId , truncate (respBody ));
304+ debug (" BODY" , "HTTP response body: requestId={}, body={}" , requestId , truncate (respBody ));
306305 });
307306 }
308307
@@ -562,7 +561,7 @@ public CompletableFuture<Void> healthAsync() {
562561 * @param args 填充消息模板占位符的参数
563562 */
564563 protected void debug (String msg , Object ... args ) {
565- debug (HttpLogLevel . BASIC , msg , args );
564+ debug (" BASIC" , msg , args );
566565 }
567566
568567 /**
@@ -572,7 +571,7 @@ protected void debug(String msg, Object... args) {
572571 * @param msg 包含 SLF4J 占位符的日志消息模板
573572 * @param args 填充消息模板占位符的参数
574573 */
575- protected void debug (HttpLogLevel level , String msg , Object ... args ) {
574+ void debug (String level , String msg , Object ... args ) {
576575 if (config .getDebug ().allows (level ) && log .isDebugEnabled ()) {
577576 log .debug (msg , args );
578577 }
0 commit comments