Skip to content

Commit

Permalink
1、修改部分核心包名及类名称
Browse files Browse the repository at this point in the history
2、完善部分注释
3、底层框架增加日志模块,并提供对外扩展接口
4、完善 Demo
  • Loading branch information
RockyQu committed May 7, 2018
1 parent d44a457 commit 524a713
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 8 deletions.
1 change: 1 addition & 0 deletions App/src/main/java/me/mvp/demo/mvp/main/MainActivity.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package me.mvp.demo.mvp.main;

import android.os.Bundle;
import android.os.Handler;
import android.support.annotation.NonNull;
import android.support.v4.content.ContextCompat;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,7 @@ public Cache build(CacheType type) {
@Provides
NetworkInterceptor.Level provideHttpLogLevel() {
Logg.init(new LoggConfiguration.Buidler()
.setDebug(httpLogLevel != null
&& (httpLogLevel == NetworkInterceptor.Level.ALL || httpLogLevel == NetworkInterceptor.Level.SIMPLE))
.setDebug(httpLogLevel != null && httpLogLevel == NetworkInterceptor.Level.ALL)
.build());
return httpLogLevel == null ? NetworkInterceptor.Level.ALL : httpLogLevel;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ public class NetworkInterceptor implements Interceptor {

public enum Level {
NONE,// 不打印任何日志
SIMPLE,// 只打印关键日志
ALL// 打印全部日志
}

Expand Down Expand Up @@ -104,8 +103,6 @@ private Request resolveRequestLogger(StringBuilder builder, Chain chain) throws
return request;
}

boolean hasSimpleLog = level == Level.SIMPLE;

RequestBody requestBody = request.body();
boolean hasRequestBody = requestBody != null;

Expand All @@ -129,7 +126,7 @@ private Request resolveRequestLogger(StringBuilder builder, Chain chain) throws

builder.append(LoggConstant.BR);

if (hasRequestBody && hasSimpleLog) {
if (hasRequestBody) {
if (requestBody.contentType() != null) {
builder.append("Content-Type: ").append(requestBody.contentType()).append(LoggConstant.BR);
}
Expand Down Expand Up @@ -202,8 +199,6 @@ private Response resolveResponseLogger(StringBuilder builder, Chain chain) throw

long tookMs = TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - startNs);

boolean hasSimpleLog = level == Level.SIMPLE;

ResponseBody responseBody = response.body();
boolean hasResponseBody = responseBody != null;

Expand Down

0 comments on commit 524a713

Please sign in to comment.