okhttp-OkGo icon indicating copy to clipboard operation
okhttp-OkGo copied to clipboard

请问有关闭默认log的api吗

Open kingyangcn opened this issue 7 years ago • 4 comments

应用正式上线,想关闭默认的log打印,请问有API接口吗?

kingyangcn avatar Feb 23 '18 03:02 kingyangcn

同问

Destiny01 avatar May 15 '18 01:05 Destiny01

设置拦截器 //log相关 HttpLoggingInterceptor loggingInterceptor = new HttpLoggingInterceptor("OkGo"); loggingInterceptor.setPrintLevel(HttpLoggingInterceptor.Level.NONE); //log打印级别,决定了log显示的详细程度 loggingInterceptor.setColorLevel(Level.INFO); //log颜色级别,决定了log在控制台显示的颜色 builder.addInterceptor(loggingInterceptor); //添加OkGo默认debug日志

public enum Level { NONE, //不打印log BASIC, //只打印 请求首行 和 响应首行 HEADERS, //打印请求和响应的所有 Header BODY //所有数据全部打印 }

NextPlayerCloud avatar Jun 15 '18 06:06 NextPlayerCloud

关键是OKGO打印的日志是info级别的。项目中如果有定时任务日志太多了

CeresY avatar Mar 23 '20 10:03 CeresY

为什么设置了不起作用?

HttpLoggingInterceptor log = new HttpLoggingInterceptor("OkGo"); log.setPrintLevel(HttpLoggingInterceptor.Level.NONE); com.lzy.okgo.OkGo.getInstance().setOkHttpClient(com.lzy.okgo.OkGo.getInstance().getOkHttpClient().newBuilder().addInterceptor(log).build());

yobdms avatar Feb 27 '23 09:02 yobdms