Skip to content

Commit

Permalink
Merge pull request duckduckgo#19 from duckduckgo/feature/remove_conso…
Browse files Browse the repository at this point in the history
…le_output

Remove logging in release
  • Loading branch information
fgei authored Jun 21, 2017
2 parents 807460e + dcb66f9 commit d602a6b
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 4 deletions.
2 changes: 2 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ dependencies {
compile 'com.jakewharton:butterknife:8.5.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.5.1'

compile 'com.jakewharton.timber:timber:4.5.1'

testCompile 'junit:junit:4.12'
testCompile 'org.mockito:mockito-core:2.2.0'
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import android.app.Application;

import timber.log.Timber;

/**
* Created by fgei on 5/15/17.
*/
Expand All @@ -11,5 +13,9 @@ public class App extends Application {
public void onCreate() {
super.onCreate();
Injector.init(this);

if (BuildConfig.DEBUG) {
Timber.plant(new Timber.DebugTree());
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
import org.json.JSONException;
import org.json.JSONObject;

import timber.log.Timber;

/**
* Created by fgei on 6/12/17.
*/
Expand Down Expand Up @@ -63,7 +65,7 @@ public String toJson() {
jsonObject.put(KEY_URL, url);
json = jsonObject.toString();
} catch (JSONException e) {
e.printStackTrace();
Timber.e(e, "toJson");
}
return json;
}
Expand All @@ -77,7 +79,7 @@ public void fromJson(String json) {
name = jsonObject.getString(KEY_NAME);
url = jsonObject.getString(KEY_URL);
} catch (JSONException e) {
e.printStackTrace();
Timber.e(e, "fromJson, json: %s", json);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
import org.json.JSONException;
import org.json.JSONObject;

import timber.log.Timber;

/**
* Created by fgei on 6/14/17.
*/
Expand Down Expand Up @@ -92,7 +94,7 @@ public String toJson() {
jsonObject.put(KEY_CAN_GO_FORWARD, canGoForward);
json = jsonObject.toString();
} catch (JSONException e) {
e.printStackTrace();
Timber.e(e, "toJson");
}
return json;
}
Expand All @@ -107,7 +109,7 @@ public void fromJson(String json) {
canGoBack = jsonObject.getBoolean(KEY_CAN_GO_BACK);
canGoForward = jsonObject.getBoolean(KEY_CAN_GO_FORWARD);
} catch (JSONException e) {
e.printStackTrace();
Timber.e(e, "fromJson, json: %s", json);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
import java.util.HashMap;
import java.util.Map;

import timber.log.Timber;

/**
* Created by fgei on 5/18/17.
*/
Expand Down Expand Up @@ -45,6 +47,7 @@ public static boolean isDuckDuckGo(@NonNull String url) {
if (authority == null) return false;
return authority.contains(Urls.BASE);
} catch (URISyntaxException e) {
Timber.e(e, "isDuckDuckGo, url: %s", url);
return false;
}
}
Expand All @@ -67,11 +70,13 @@ public static String getQuery(@NonNull String url) {
try {
result = URLDecoder.decode(result, "UTF-8");
} catch (UnsupportedEncodingException e) {
Timber.e(e, "getQuery, url: %s", url);
return "";
}
return result;
}
} catch (URISyntaxException e) {
Timber.e(e, "getQuery, url: %s", url);
return "";
}
return "";
Expand All @@ -83,6 +88,7 @@ public static String getSearchUrl(@NonNull String query) {
try {
queryEncoded = URLEncoder.encode(query, "UTF-8");
} catch (UnsupportedEncodingException e) {
Timber.e(e, "getSearchUrl, query: %s", query);
}
StringBuilder builder = new StringBuilder(Urls.HOME);
builder.append("&").append(Params.SEARCH).append("=").append(queryEncoded);
Expand Down

0 comments on commit d602a6b

Please sign in to comment.