package org.ccci.gto.android.common.crashlytics.timber;

import android.util.Log;

import com.crashlytics.android.Crashlytics;

import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import timber.log.Timber;

public final class CrashlyticsTree extends Timber.Tree {
    private int mLogLevel;

    public CrashlyticsTree() {
        mLogLevel = Log.INFO;
    }

    public CrashlyticsTree(final int logLevel) {
        mLogLevel = logLevel;
    }

    @Override
    protected boolean isLoggable(@Nullable final String tag, final int priority) {
        return mLogLevel <= priority;
    }

    @Override
    protected void log(final int priority, @Nullable final String tag, @NotNull final String message,
                       @Nullable final Throwable t) {
        Crashlytics.log(priority, tag, message);

        if (t != null) {
            Crashlytics.logException(t);
        }
    }
}

@@ -317,16 +317,52 @@
 ogLevel;
+%0A    private int mExceptionLogLevel;
 %0A%0A    pu
@@ -398,107 +398,279 @@
     
-mLogLevel = Log.INFO;%0A    %7D%0A%0A    public CrashlyticsTree(final int logLevel) %7B%0A        mLogLevel = l
+this(Log.INFO, Log.ERROR);%0A    %7D%0A%0A    public CrashlyticsTree(final int logLevel) %7B%0A        this(logLevel, logLevel);%0A    %7D%0A%0A    public CrashlyticsTree(final int logLevel, final int exceptionLogLevel) %7B%0A        mLogLevel = logLevel;%0A        mExceptionLogLevel = exceptionL
 ogLe
@@ -1064,16 +1064,50 @@
  != null
+ && mExceptionLogLevel %3C= priority
 ) %7B%0A    

make it possible to specify a different log level for exceptions and messages