A few more minor logging changes

This commit is contained in:
Joseph Reeve 2017-08-25 14:05:01 +01:00 committed by Julian Harty
parent 0fa2d4e66c
commit e787105961
7 changed files with 19 additions and 19 deletions

View File

@ -1648,7 +1648,7 @@ public class KiwixMobileActivity extends BaseActivity implements WebViewCallback
} }
selectTab(currentTab); selectTab(currentTab);
} catch (Exception e) { } catch (Exception e) {
Log.w(TAG_KIWIX, " Kiwix sharedpreferences corrupted"); Log.w(TAG_KIWIX, "Kiwix shared preferences corrupted", e);
//TODO: Show to user //TODO: Show to user
} }
} }
@ -1663,7 +1663,7 @@ public class KiwixMobileActivity extends BaseActivity implements WebViewCallback
return; return;
} }
Log.d(TAG_KIWIX, " Kiwix started from a filemanager. Intent filePath: " Log.d(TAG_KIWIX, "Kiwix started from a filemanager. Intent filePath: "
+ filePath + filePath
+ " -> open this zimfile and load menu_main page"); + " -> open this zimfile and load menu_main page");
openZimFile(new File(filePath), false); openZimFile(new File(filePath), false);
@ -1672,14 +1672,14 @@ public class KiwixMobileActivity extends BaseActivity implements WebViewCallback
String zimFile = settings.getString(TAG_CURRENT_FILE, null); String zimFile = settings.getString(TAG_CURRENT_FILE, null);
if (zimFile != null && new File(zimFile).exists()) { if (zimFile != null && new File(zimFile).exists()) {
Log.d(TAG_KIWIX, Log.d(TAG_KIWIX,
" Kiwix normal start, zimFile loaded last time -> Open last used zimFile " + zimFile); "Kiwix normal start, zimFile loaded last time -> Open last used zimFile " + zimFile);
restoreTabStates(); restoreTabStates();
// Alternative would be to restore webView state. But more effort to implement, and actually // Alternative would be to restore webView state. But more effort to implement, and actually
// fits better normal android behavior if after closing app ("back" button) state is not maintained. // fits better normal android behavior if after closing app ("back" button) state is not maintained.
} else { } else {
if (BuildConfig.IS_CUSTOM_APP) { if (BuildConfig.IS_CUSTOM_APP) {
Log.d(TAG_KIWIX, "Kiwix Custom App starting for the first time. Check Companion ZIM: " + BuildConfig.ZIM_FILE_NAME); Log.d(TAG_KIWIX, "Kiwix Custom App starting for the first time. Checking Companion ZIM: " + BuildConfig.ZIM_FILE_NAME);
String currentLocaleCode = Locale.getDefault().toString(); String currentLocaleCode = Locale.getDefault().toString();
// Custom App recommends to start off a specific language // Custom App recommends to start off a specific language
@ -1742,8 +1742,7 @@ public class KiwixMobileActivity extends BaseActivity implements WebViewCallback
openZimFile(new File(filePath), true); openZimFile(new File(filePath), true);
} }
} else { } else {
Log.d(TAG_KIWIX, Log.d(TAG_KIWIX, "Kiwix normal start, no zimFile loaded last time -> display help page");
" Kiwix normal start, no zimFile loaded last time -> display help page");
showHelpPage(); showHelpPage();
} }
} }
@ -1757,8 +1756,7 @@ public class KiwixMobileActivity extends BaseActivity implements WebViewCallback
saveTabStates(); saveTabStates();
refreshBookmarks(); refreshBookmarks();
Log.d(TAG_KIWIX, Log.d(TAG_KIWIX, "onPause Save currentzimfile to preferences: " + ZimContentProvider.getZimFile());
"onPause Save currentzimfile to preferences:" + ZimContentProvider.getZimFile());
} }
@Override public void webViewUrlLoading() { @Override public void webViewUrlLoading() {

View File

@ -50,6 +50,7 @@ public class KiwixWebViewClient extends WebViewClient {
return true; return true;
} else if (url.startsWith(ZimContentProvider.UI_URI.toString())) { } else if (url.startsWith(ZimContentProvider.UI_URI.toString())) {
Log.e("KiwixWebViewClient", "UI Url " + url + " not supported."); Log.e("KiwixWebViewClient", "UI Url " + url + " not supported.");
//TODO: Document this code - what's a UI_URL?
return true; return true;
} }

View File

@ -98,7 +98,7 @@ public class ZimContentProvider extends ContentProvider {
public synchronized static String setZimFile(String fileName) { public synchronized static String setZimFile(String fileName) {
if (!jniKiwix.loadZIM(fileName)) { if (!jniKiwix.loadZIM(fileName)) {
Log.w(TAG_KIWIX, "Unable to open the ZIM file " + fileName); Log.e(TAG_KIWIX, "Unable to open the ZIM file " + fileName);
zimFileName = null; zimFileName = null;
} else { } else {
Log.i(TAG_KIWIX, "Opening ZIM file " + fileName); Log.i(TAG_KIWIX, "Opening ZIM file " + fileName);
@ -107,7 +107,7 @@ public class ZimContentProvider extends ContentProvider {
/* Try to open the corresponding fulltext index */ /* Try to open the corresponding fulltext index */
String fullText = getFulltextIndexPath(fileName); String fullText = getFulltextIndexPath(fileName);
if (!jniKiwix.loadFulltextIndex(fullText)) { if (!jniKiwix.loadFulltextIndex(fullText)) {
Log.w(TAG_KIWIX, "Unable to open the ZIM fulltext index " + fullText); Log.e(TAG_KIWIX, "Unable to open the ZIM fulltext index " + fullText);
} }
} }
return zimFileName; return zimFileName;
@ -464,13 +464,13 @@ public class ZimContentProvider extends ContentProvider {
Log.d(TAG_KIWIX, "reading " + articleZimUrl Log.d(TAG_KIWIX, "reading " + articleZimUrl
+ "(mime: " + mime.value + ", size: " + size.value + ") finished."); + "(mime: " + mime.value + ", size: " + size.value + ") finished.");
} catch (IOException | NullPointerException e) { } catch (IOException | NullPointerException e) {
Log.w(TAG_KIWIX, "Exception reading article " + articleZimUrl + " from zim file", Log.e(TAG_KIWIX, "Exception reading article " + articleZimUrl + " from zim file",
e); e);
} finally { } finally {
try { try {
out.close(); out.close();
} catch (IOException e) { } catch (IOException e) {
Log.w(TAG_KIWIX, Log.e(TAG_KIWIX,
"Custom exception by closing out stream for article " + articleZimUrl, "Custom exception by closing out stream for article " + articleZimUrl,
e); e);
} }

View File

@ -60,7 +60,8 @@ public class KiwixTextToSpeech {
initialized = true; initialized = true;
onInitSucceedListener.onInitSucceed(); onInitSucceedListener.onInitSucceed();
} else { } else {
Log.w(TAG_KIWIX, "Initilization of TextToSpeech Failed!"); Log.e(TAG_KIWIX, "Initialization of TextToSpeech Failed!");
//TODO: Surface to user
} }
}); });
} }
@ -249,7 +250,8 @@ public class KiwixTextToSpeech {
@Override @Override
public void onError(String s) { public void onError(String s) {
Log.w(TAG_KIWIX, "TextToSpeech Error: " + s); Log.e(TAG_KIWIX, "TextToSpeech Error: " + s);
//TODO: Surface to user
} }
}); });
} }

View File

@ -195,7 +195,7 @@ public class LanguageUtils {
field.setBoolean(layoutInflater, false); field.setBoolean(layoutInflater, false);
layoutInflater.setFactory(new LayoutInflaterFactory(mContext, layoutInflater)); layoutInflater.setFactory(new LayoutInflaterFactory(mContext, layoutInflater));
} catch (NoSuchFieldException | IllegalAccessException | IllegalArgumentException e) { } catch (NoSuchFieldException | IllegalAccessException | IllegalArgumentException e) {
Log.w(TAG_KIWIX, "could not access private field of the LayoutInflater"); Log.w(TAG_KIWIX, "Font Change Failed: Could not access private field of the LayoutInflater", e);
} }
} }
@ -264,8 +264,7 @@ public class LanguageUtils {
return view; return view;
} catch (InflateException | ClassNotFoundException e) { } catch (InflateException | ClassNotFoundException e) {
Log.w(TAG_KIWIX, Log.w(TAG_KIWIX, "Could not apply the custom font to " + name, e);
"Could not apply the custom font to " + name + " " + e.getMessage());
} }
} }

View File

@ -77,7 +77,7 @@ public class NetworkUtils {
details = details.trim().replaceAll(" +", " "); details = details.trim().replaceAll(" +", " ");
return details; return details;
} catch (Exception e) { } catch (Exception e) {
Log.d(KiwixMobileActivity.TAG_KIWIX, "Context invalid url: " + url); Log.d(KiwixMobileActivity.TAG_KIWIX, "Context invalid url: " + url, e);
return ""; return "";
} }
} }

View File

@ -209,7 +209,7 @@ public class ZimFileSelectFragment extends Fragment
public void onBookFound(LibraryNetworkEntity.Book book) { public void onBookFound(LibraryNetworkEntity.Book book) {
if (!mFiles.contains(book)) { if (!mFiles.contains(book)) {
context.runOnUiThread(() -> { context.runOnUiThread(() -> {
Log.i("Scanner", "File Search: Found Book "+book.title); Log.i("Scanner", "File Search: Found Book " + book.title);
mFiles.add(book); mFiles.add(book);
mRescanAdapter.notifyDataSetChanged(); mRescanAdapter.notifyDataSetChanged();
checkEmpty(); checkEmpty();