Skip to content

Commit

Permalink
turn on/off logs
Browse files Browse the repository at this point in the history
  • Loading branch information
bmutinda committed Feb 14, 2017
1 parent 9c66685 commit 3e8a1e5
Show file tree
Hide file tree
Showing 4 changed files with 3,091 additions and 9 deletions.
8 changes: 1 addition & 7 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ public void onCreate(){
private void initializeApi(){
Api api = new Api();
api.setEndpoint("http://10.0.2.2/apps/httpbuster/api/v1/");
httpBuster = HttpBuster.withApi(api).build();
httpBuster = HttpBuster.withApi(api)
.enableLogs(true)
.build();
}

public static HttpBuster getHttpBuster(){
Expand Down
11 changes: 10 additions & 1 deletion library/src/main/java/com/bmutinda/httpbuster/HttpBuster.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,18 @@ public class HttpBuster {
private OkHttpClient okHttpClient;
private Api api;
private Configuration configuration;
public static boolean debug = false;

private HttpBuster(Api api){
this.api = api;
}

public HttpBuster withConfiguration( Configuration configuration ){
public HttpBuster enableLogs( boolean enable ){
debug = enable;
return this;
}

public HttpBuster withConfiguration(Configuration configuration ){
this.configuration = configuration;
return this;
}
Expand Down Expand Up @@ -120,6 +126,9 @@ public static HttpBuster withApi( Api api ){
}

public static void log( String message ){
if ( ! debug ){
return;
}
Log.e("HttpBuster", message);
}
}
Loading

0 comments on commit 3e8a1e5

Please sign in to comment.