Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

setLevel okhttp LoggingInterceptor deprecated

setLevel(okhttp3.logging.HttpLoggingInterceptor.Level)' is deprecated

what should replace with setLevel? to remove the deprecated issue

like image 877
Eldhopj Avatar asked Jul 01 '19 18:07

Eldhopj


1 Answers

According to the documentation "Moved to var. Replace setLevel(...) with level(...) to fix Java",

Replace setLevel(...) with level(...) will fix this issue

in Java:

HttpLoggingInterceptor logging = new HttpLoggingInterceptor();
logging.level(HttpLoggingInterceptor.Level.BODY);

in Kotlin

val logging = HttpLoggingInterceptor()
logging.level = HttpLoggingInterceptor.Level.BODY

Happy coding :)

like image 108
Eldhopj Avatar answered Nov 19 '22 11:11

Eldhopj