From 3bb9d61ff996b2d76a115667db42c60aadf4f024 Mon Sep 17 00:00:00 2001 From: Bradlee Speice Date: Sun, 5 Apr 2015 21:31:09 -0400 Subject: [PATCH] Switch the logging framework --- app/build.gradle | 1 + .../java/org/bspeice/minimalbible/MinimalBibleDebug.java | 6 ++++++ .../main/java/org/bspeice/minimalbible/MinimalBible.java | 9 ++++++--- .../bspeice/minimalbible/activity/viewer/PassageView.kt | 4 ++-- .../service/format/osisparser/handler/UnknownHandler.kt | 4 ++-- 5 files changed, 17 insertions(+), 7 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 23c2d21..3c0b353 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -77,6 +77,7 @@ dependencies { compile 'com.android.support:recyclerview-v7:+' compile 'com.android.support:cardview-v7:+' compile 'org.apache.commons:commons-lang3:+' + compile 'com.orhanobut:logger:+' compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" androidTestCompile 'com.jayway.awaitility:awaitility:+' diff --git a/app/src/debug/java/org/bspeice/minimalbible/MinimalBibleDebug.java b/app/src/debug/java/org/bspeice/minimalbible/MinimalBibleDebug.java index 358d061..7727b1b 100644 --- a/app/src/debug/java/org/bspeice/minimalbible/MinimalBibleDebug.java +++ b/app/src/debug/java/org/bspeice/minimalbible/MinimalBibleDebug.java @@ -1,5 +1,8 @@ package org.bspeice.minimalbible; +import com.orhanobut.logger.LogLevel; +import com.orhanobut.logger.Logger; + /** * Create a MinimalBible application that we can extend from the main release * Currently it's not doing much, but would allow for shenanigans during testing in the future @@ -15,6 +18,9 @@ public class MinimalBibleDebug extends MinimalBible implements Injector { @Override public void onCreate() { super.onCreate(); + Logger.init("MinimalBible") + .setLogLevel(LogLevel.FULL); + Logger.d("Beginning application run..."); // ACRA.init(this); } } \ No newline at end of file diff --git a/app/src/main/java/org/bspeice/minimalbible/MinimalBible.java b/app/src/main/java/org/bspeice/minimalbible/MinimalBible.java index c9a85da..e13d845 100644 --- a/app/src/main/java/org/bspeice/minimalbible/MinimalBible.java +++ b/app/src/main/java/org/bspeice/minimalbible/MinimalBible.java @@ -2,7 +2,9 @@ package org.bspeice.minimalbible; import android.app.Application; import android.content.Context; -import android.util.Log; + +import com.orhanobut.logger.LogLevel; +import com.orhanobut.logger.Logger; import org.crosswire.jsword.book.sword.SwordBookPath; @@ -24,6 +26,7 @@ public class MinimalBible extends Application implements Injector { @Override public void onCreate() { super.onCreate(); + Logger.init().setLogLevel(LogLevel.NONE); buildObjGraph(); setJswordHome(); } @@ -49,10 +52,10 @@ public class MinimalBible extends Application implements Injector { // We need to set the download directory for jSword to stick with // Android. String home = this.getFilesDir().toString(); - Log.d(TAG, "Setting jsword.home to: " + home); + Logger.d(TAG, "Setting jsword.home to: " + home); System.setProperty("jsword.home", home); System.setProperty("sword.home", home); SwordBookPath.setDownloadDir(new File(home)); - Log.d(TAG, "Sword download path: " + SwordBookPath.getSwordDownloadDir()); + Logger.d(TAG, "Sword download path: " + SwordBookPath.getSwordDownloadDir()); } } \ No newline at end of file diff --git a/app/src/main/kotlin/org/bspeice/minimalbible/activity/viewer/PassageView.kt b/app/src/main/kotlin/org/bspeice/minimalbible/activity/viewer/PassageView.kt index a7393f4..9c4876f 100644 --- a/app/src/main/kotlin/org/bspeice/minimalbible/activity/viewer/PassageView.kt +++ b/app/src/main/kotlin/org/bspeice/minimalbible/activity/viewer/PassageView.kt @@ -2,8 +2,8 @@ package org.bspeice.minimalbible.activity.viewer import android.support.v7.widget.RecyclerView import android.text.SpannableStringBuilder -import android.util.Log import android.widget.TextView +import com.orhanobut.logger.Logger import org.bspeice.minimalbible.service.format.osisparser.OsisParser import org.crosswire.jsword.book.Book import org.crosswire.jsword.book.getVersification @@ -22,7 +22,7 @@ class PassageView(val v: TextView, val b: Book) } fun bind(info: BookAdapter.ChapterInfo) { - Log.d("PassageView", "Binding chapter ${info.chapter}") + Logger.d("PassageView", "Binding chapter ${info.chapter}") v setText getAllVerses(info.vStart..info.vEnd, info) } } \ No newline at end of file diff --git a/app/src/main/kotlin/org/bspeice/minimalbible/service/format/osisparser/handler/UnknownHandler.kt b/app/src/main/kotlin/org/bspeice/minimalbible/service/format/osisparser/handler/UnknownHandler.kt index db916ec..f078cc2 100644 --- a/app/src/main/kotlin/org/bspeice/minimalbible/service/format/osisparser/handler/UnknownHandler.kt +++ b/app/src/main/kotlin/org/bspeice/minimalbible/service/format/osisparser/handler/UnknownHandler.kt @@ -1,7 +1,7 @@ package org.bspeice.minimalbible.service.format.osisparser.handler import android.text.SpannableStringBuilder -import android.util.Log +import com.orhanobut.logger.Logger import org.bspeice.minimalbible.service.format.osisparser.VerseContent /** @@ -9,6 +9,6 @@ import org.bspeice.minimalbible.service.format.osisparser.VerseContent */ class UnknownHandler(val tagName: String) : TagHandler { override fun render(builder: SpannableStringBuilder, info: VerseContent, chars: String) { - Log.d("UnknownHandler", "Unknown tag $tagName received text: $chars") + Logger.w("Unknown tag '$tagName' received text: '$chars'") } } \ No newline at end of file