Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ff274e29 authored by Vincent Breitmoser's avatar Vincent Breitmoser
Browse files

use Timber for logging

parent 88a86a14
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -34,6 +34,7 @@ dependencies {
    compile 'de.cketti.safecontentresolver:safe-content-resolver-v14:0.9.0'
    compile 'com.github.amlcurran.showcaseview:library:5.4.1'
    compile 'com.squareup.moshi:moshi:1.2.0'
    compile 'com.jakewharton.timber:timber:4.5.1'

    androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.2'

+4 −4
Original line number Diff line number Diff line
@@ -19,7 +19,7 @@ import android.content.Context;
import android.database.Cursor;
import android.graphics.Color;
import android.net.Uri;
import android.util.Log;
import timber.log.Timber;

import com.fsck.k9.activity.setup.AccountSetupCheckSettings.CheckDirection;
import com.fsck.k9.helper.Utility;
@@ -760,7 +760,7 @@ public class Account implements BaseAccount, StoreConfig {
        try {
            getLocalStore().resetVisibleLimits(getDisplayCount());
        } catch (MessagingException e) {
            Log.e(K9.LOG_TAG, "Unable to reset visible limits", e);
            Timber.e("Unable to reset visible limits", e);
        }

    }
@@ -953,7 +953,7 @@ public class Account implements BaseAccount, StoreConfig {
                switchLocalStorage(id);
                successful = true;
            } catch (MessagingException e) {
                Log.e(K9.LOG_TAG, "Switching local storage provider from " +
                Timber.e("Switching local storage provider from " +
                        mLocalStorageProviderId + " to " + id + " failed.", e);
            }

+18 −14
Original line number Diff line number Diff line
@@ -24,7 +24,7 @@ import android.os.Handler;
import android.os.Looper;
import android.os.StrictMode;
import android.text.format.Time;
import android.util.Log;
import timber.log.Timber;

import com.fsck.k9.Account.SortType;
import com.fsck.k9.activity.MessageCompose;
@@ -45,6 +45,11 @@ import com.fsck.k9.service.MailService;
import com.fsck.k9.service.ShutdownReceiver;
import com.fsck.k9.service.StorageGoneReceiver;
import com.fsck.k9.widget.list.MessageListWidgetProvider;
import timber.log.Timber;

import static timber.log.Timber.i;
import static timber.log.Timber.v;


public class K9 extends Application {
    /**
@@ -416,7 +421,7 @@ public class K9 extends Application {
                try {
                    queue.put(new Handler());
                } catch (InterruptedException e) {
                    Log.e(K9.LOG_TAG, "", e);
                    Timber.e("", e);
                }
                Looper.loop();
            }
@@ -426,13 +431,13 @@ public class K9 extends Application {
        try {
            final Handler storageGoneHandler = queue.take();
            registerReceiver(receiver, filter, null, storageGoneHandler);
            Log.i(K9.LOG_TAG, "Registered: unmount receiver");
            i("Registered: unmount receiver");
        } catch (InterruptedException e) {
            Log.e(K9.LOG_TAG, "Unable to register unmount receiver", e);
            Timber.e("Unable to register unmount receiver", e);
        }

        registerReceiver(new ShutdownReceiver(), new IntentFilter(Intent.ACTION_SHUTDOWN));
        Log.i(K9.LOG_TAG, "Registered: shutdown receiver");
        i("Registered: shutdown receiver");
    }

    public static void save(StorageEditor editor) {
@@ -566,11 +571,10 @@ public class K9 extends Application {
                intent.putExtra(K9.Intents.EmailReceived.EXTRA_FROM_SELF, account.isAnIdentity(message.getFrom()));
                K9.this.sendBroadcast(intent);
                if (K9.DEBUG)
                    Log.d(K9.LOG_TAG, "Broadcasted: action=" + action
                    Timber.d("Broadcasted: action=" + action
                            + " account=" + account.getDescription()
                            + " folder=" + folder
                          + " message uid=" + message.getUid()
                         );
                            + " message uid=" + message.getUid());
            }

            private void updateUnreadWidget() {
@@ -578,7 +582,7 @@ public class K9 extends Application {
                    UnreadWidgetProvider.updateUnreadCount(K9.this);
                } catch (Exception e) {
                    if (K9.DEBUG) {
                        Log.e(LOG_TAG, "Error while updating unread widget(s)", e);
                        Timber.e("Error while updating unread widget(s)", e);
                    }
                }
            }
@@ -590,7 +594,7 @@ public class K9 extends Application {
                    if (BuildConfig.DEBUG) {
                        throw e;
                    } else if (K9.DEBUG) {
                        Log.e(LOG_TAG, "Error while updating message list widget", e);
                        Timber.e("Error while updating message list widget", e);
                    }
                }
            }
@@ -800,12 +804,12 @@ public class K9 extends Application {
        synchronized (observers) {
            for (final ApplicationAware aware : observers) {
                if (K9.DEBUG) {
                    Log.v(K9.LOG_TAG, "Initializing observer: " + aware);
                    v("Initializing observer: " + aware);
                }
                try {
                    aware.initializeComponent(this);
                } catch (Exception e) {
                    Log.w(K9.LOG_TAG, "Failure when notifying " + aware, e);
                    Timber.w("Failure when notifying " + aware, e);
                }
            }

+6 −4
Original line number Diff line number Diff line
@@ -10,12 +10,14 @@ import java.util.List;
import java.util.Map;

import android.content.Context;
import android.util.Log;
import timber.log.Timber;

import com.fsck.k9.mail.store.RemoteStore;
import com.fsck.k9.mailstore.LocalStore;
import com.fsck.k9.preferences.StorageEditor;
import com.fsck.k9.preferences.Storage;
import timber.log.Timber;


public class Preferences {

@@ -40,7 +42,7 @@ public class Preferences {
        mStorage = Storage.getStorage(context);
        mContext = context;
        if (mStorage.isEmpty()) {
            Log.i(K9.LOG_TAG, "Preferences storage is zero-size, importing from Android-style preferences");
            Timber.i("Preferences storage is zero-size, importing from Android-style preferences");
            StorageEditor editor = mStorage.edit();
            editor.copy(context.getSharedPreferences("AndroidMail.Main", Context.MODE_PRIVATE));
            editor.commit();
@@ -128,7 +130,7 @@ public class Preferences {
        try {
            RemoteStore.removeInstance(account);
        } catch (Exception e) {
            Log.e(K9.LOG_TAG, "Failed to reset remote store for account " + account.getUuid(), e);
            Timber.e("Failed to reset remote store for account " + account.getUuid(), e);
        }
        LocalStore.removeAccount(account);

@@ -176,7 +178,7 @@ public class Preferences {
            try {
                return Enum.valueOf(defaultEnum.getDeclaringClass(), stringPref);
            } catch (IllegalArgumentException ex) {
                Log.w(K9.LOG_TAG, "Unable to convert preference key [" + key +
                Timber.w("Unable to convert preference key [" + key +
                        "] value [" + stringPref + "] to enum of type " + defaultEnum.getDeclaringClass(), ex);

                return defaultEnum;
+6 −3
Original line number Diff line number Diff line
@@ -16,12 +16,15 @@

package com.fsck.k9;

import android.os.Handler;
import android.util.Log;

import java.util.Timer;
import java.util.TimerTask;

import android.os.Handler;

import timber.log.Timber;


/**
 * This class used to "throttle" a flow of events.
 *
@@ -94,7 +97,7 @@ public class Throttle {
    }

    private void debugLog(String message) {
        Log.d(K9.LOG_TAG, "Throttle: [" + mName + "] " + message);
        Timber.d("Throttle: [" + mName + "] " + message);
    }

    private boolean isCallbackScheduled() {
Loading