Switch the logging framework

This commit is contained in:
Bradlee Speice 2015-04-05 21:31:09 -04:00
parent fdec1e3ed8
commit 3bb9d61ff9
5 changed files with 17 additions and 7 deletions

View File

@ -77,6 +77,7 @@ dependencies {
compile 'com.android.support:recyclerview-v7:+' compile 'com.android.support:recyclerview-v7:+'
compile 'com.android.support:cardview-v7:+' compile 'com.android.support:cardview-v7:+'
compile 'org.apache.commons:commons-lang3:+' compile 'org.apache.commons:commons-lang3:+'
compile 'com.orhanobut:logger:+'
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
androidTestCompile 'com.jayway.awaitility:awaitility:+' androidTestCompile 'com.jayway.awaitility:awaitility:+'

View File

@ -1,5 +1,8 @@
package org.bspeice.minimalbible; 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 * 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 * 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 @Override
public void onCreate() { public void onCreate() {
super.onCreate(); super.onCreate();
Logger.init("MinimalBible")
.setLogLevel(LogLevel.FULL);
Logger.d("Beginning application run...");
// ACRA.init(this); // ACRA.init(this);
} }
} }

View File

@ -2,7 +2,9 @@ package org.bspeice.minimalbible;
import android.app.Application; import android.app.Application;
import android.content.Context; 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; import org.crosswire.jsword.book.sword.SwordBookPath;
@ -24,6 +26,7 @@ public class MinimalBible extends Application implements Injector {
@Override @Override
public void onCreate() { public void onCreate() {
super.onCreate(); super.onCreate();
Logger.init().setLogLevel(LogLevel.NONE);
buildObjGraph(); buildObjGraph();
setJswordHome(); setJswordHome();
} }
@ -49,10 +52,10 @@ public class MinimalBible extends Application implements Injector {
// We need to set the download directory for jSword to stick with // We need to set the download directory for jSword to stick with
// Android. // Android.
String home = this.getFilesDir().toString(); 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("jsword.home", home);
System.setProperty("sword.home", home); System.setProperty("sword.home", home);
SwordBookPath.setDownloadDir(new File(home)); SwordBookPath.setDownloadDir(new File(home));
Log.d(TAG, "Sword download path: " + SwordBookPath.getSwordDownloadDir()); Logger.d(TAG, "Sword download path: " + SwordBookPath.getSwordDownloadDir());
} }
} }

View File

@ -2,8 +2,8 @@ package org.bspeice.minimalbible.activity.viewer
import android.support.v7.widget.RecyclerView import android.support.v7.widget.RecyclerView
import android.text.SpannableStringBuilder import android.text.SpannableStringBuilder
import android.util.Log
import android.widget.TextView import android.widget.TextView
import com.orhanobut.logger.Logger
import org.bspeice.minimalbible.service.format.osisparser.OsisParser import org.bspeice.minimalbible.service.format.osisparser.OsisParser
import org.crosswire.jsword.book.Book import org.crosswire.jsword.book.Book
import org.crosswire.jsword.book.getVersification import org.crosswire.jsword.book.getVersification
@ -22,7 +22,7 @@ class PassageView(val v: TextView, val b: Book)
} }
fun bind(info: BookAdapter.ChapterInfo) { 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) v setText getAllVerses(info.vStart..info.vEnd, info)
} }
} }

View File

@ -1,7 +1,7 @@
package org.bspeice.minimalbible.service.format.osisparser.handler package org.bspeice.minimalbible.service.format.osisparser.handler
import android.text.SpannableStringBuilder import android.text.SpannableStringBuilder
import android.util.Log import com.orhanobut.logger.Logger
import org.bspeice.minimalbible.service.format.osisparser.VerseContent 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 { class UnknownHandler(val tagName: String) : TagHandler {
override fun render(builder: SpannableStringBuilder, info: VerseContent, chars: String) { 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'")
} }
} }