From 4a28658c964b4209db82aac88f31b139a8efd8a4 Mon Sep 17 00:00:00 2001 From: Vincent Breitmoser Date: Sat, 20 Jan 2018 02:13:16 +0100 Subject: [PATCH] plant DebugTree on startup --- .../keychain/KeychainApplication.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/KeychainApplication.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/KeychainApplication.java index 8ded1f795..8327ec0a5 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/KeychainApplication.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/KeychainApplication.java @@ -41,6 +41,7 @@ import org.sufficientlysecure.keychain.ui.util.FormattingUtils; import org.sufficientlysecure.keychain.util.PRNGFixes; import org.sufficientlysecure.keychain.util.Preferences; import timber.log.Timber; +import timber.log.Timber.DebugTree; public class KeychainApplication extends Application { @@ -73,6 +74,8 @@ public class KeychainApplication extends Application { PRNGFixes.apply(); Timber.d("Bouncy Castle set and PRNG Fixes applied!"); + updateLoggingStatus(); + /* if (Constants.DEBUG) { Provider[] providers = Security.getProviders(); @@ -171,4 +174,12 @@ public class KeychainApplication extends Application { } } } + + private void updateLoggingStatus() { + Timber.uprootAll(); + boolean enableDebugLogging = BuildConfig.DEBUG; + if (enableDebugLogging) { + Timber.plant(new DebugTree()); + } + } }