Android Open Source - LimeLight Lime Light Log






From Project

Back to project page LimeLight.

License

The source code is released under:

GNU General Public License

If you think the Android project LimeLight listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

/**
 This Source Code Form is subject to the terms of the Mozilla Public
 License, v. 2.0, as well as to the Additional Term regarding proper
 attribution. The latter is located in Term 11 of the License.
 If a copy of the MPL with the Additional Term was not distributed
 with this file, You can obtain one at http://static.fuzzhq.com/licenses/MPL
 *//*from   ww w  .  j  av a 2s  . c  o  m*/

package com.fuzz.android.limelight.util;

import android.util.Log;
import android.util.Pair;

/**
 * @author James Davis (Fuzz)
 */
public class LimeLightLog {
    private static boolean mAlwaysShowFullStackTrace = false;
    public static void alwaysShowFullStackTrace(boolean enable){
        mAlwaysShowFullStackTrace = enable;
    }

    private static Pair<String, String> getPreparedTagAndMessage(String message){
        return getPreparedTagAndMessage(message, false);
    }

    private static Pair<String, String> getPreparedTagAndMessage(String message, boolean printFullStackTrace){
        final StackTraceElement[] ste = Thread.currentThread().getStackTrace();
        int index = 0;
        for (int i = 0; i < ste.length; i++) {
            if (ste[i].getMethodName().compareTo("getPreparedTagAndMessage") == 0)
            {
                index = i + 2;
                if ( ste.length != i + 1){
                    if (ste[i + 1].getMethodName().compareTo("getPreparedTagAndMessage") != 0){
                        break;
                    }
                }
            }
        }

        String messageTrace = message;

        for (int i = index; i < (printFullStackTrace || mAlwaysShowFullStackTrace? ste.length : index + 1); i++) {
            messageTrace
                    += "\nat "
                    +  ste[i].getClassName()
                    +  "."
                    +  ste[i].getMethodName()
                    + "("
                    +  ste[i].getClassName().substring(ste[i].getClassName().lastIndexOf(".") + 1)
                    +  ".java:"
                    +  String.valueOf(ste[i].getLineNumber())
                    +  ")";
        }

        return new Pair<String, String>(
                "LimeLight | " + ste[index].getMethodName() + "()", messageTrace);
    }

    public static int d(String message, Throwable thr) {
        Pair<String, String> output = getPreparedTagAndMessage(message);
        return Log.d(output.first, output.second, thr);
    }

    public static int d(String message) {
        Pair<String, String> output = getPreparedTagAndMessage(message);
        return Log.d(output.first, output.second);
    }

    public static int i(String message, Throwable thr) {
        Pair<String, String> output = getPreparedTagAndMessage(message);
        return Log.i(output.first, output.second, thr);
    }

    public static int i(String message) {
        Pair<String, String> output = getPreparedTagAndMessage(message);
        return Log.i(output.first, output.second);
    }

    public static int w(String message, Throwable thr) {
        Pair<String, String> output = getPreparedTagAndMessage(message);
        return Log.w(output.first, output.second, thr);
    }

    public static int w(String message) {
        Pair<String, String> output = getPreparedTagAndMessage(message);
        return Log.w(output.first, output.second);
    }

    public static int e(String message, Throwable thr) {
        Pair<String, String> output = getPreparedTagAndMessage(message, true);
        return Log.e(output.first, output.second, thr);
    }

    public static int e(String message) {
        Pair<String, String> output = getPreparedTagAndMessage(message, true);
        return Log.e(output.first, output.second);
    }

    public static int wtf(String message, Throwable thr) {
        Pair<String, String> output = getPreparedTagAndMessage(message, true);
        return Log.wtf(output.first, output.second, thr);
    }

    public static int wtf(String message) {
        Pair<String, String> output = getPreparedTagAndMessage(message, true);
        return Log.wtf(output.first, output.second);
    }
}




Java Source Code List

com.fuzz.android.limelight.LimeLight.java
com.fuzz.android.limelight.animation.AnimationHolder.java
com.fuzz.android.limelight.animation.LeftRightAnimation.java
com.fuzz.android.limelight.animation.UpDownAnimation.java
com.fuzz.android.limelight.automate.DrawerAutomator.java
com.fuzz.android.limelight.automate.ViewAutomator.java
com.fuzz.android.limelight.model.ActToViewHelper.java
com.fuzz.android.limelight.model.Act.java
com.fuzz.android.limelight.model.BaseChapter.java
com.fuzz.android.limelight.model.Book.java
com.fuzz.android.limelight.model.ChapterTransition.java
com.fuzz.android.limelight.model.Chapter.java
com.fuzz.android.limelight.model.ModelHelper.java
com.fuzz.android.limelight.model.Text.java
com.fuzz.android.limelight.model.Transition.java
com.fuzz.android.limelight.recorder.FontListAdapter.java
com.fuzz.android.limelight.recorder.RecorderClickListener.java
com.fuzz.android.limelight.recorder.RecorderWindow.java
com.fuzz.android.limelight.recorder.Recorder.java
com.fuzz.android.limelight.recorder.widget.color.ColorHueSlider.java
com.fuzz.android.limelight.recorder.widget.color.ColorPickDialog.java
com.fuzz.android.limelight.recorder.widget.color.ColorSquareView.java
com.fuzz.android.limelight.recorder.widget.color.OnColorChangedListener.java
com.fuzz.android.limelight.recorder.widget.drag.DragAndEditView.java
com.fuzz.android.limelight.recorder.widget.drag.EditorFrameLayout.java
com.fuzz.android.limelight.recorder.widget.drag.OffSetChangeListener.java
com.fuzz.android.limelight.recorder.widget.editor.ActEditor.java
com.fuzz.android.limelight.recorder.widget.editor.ActIconAdapter.java
com.fuzz.android.limelight.recorder.widget.editor.operations.BaseOperation.java
com.fuzz.android.limelight.recorder.widget.editor.operations.ChangeAnimationOperation.java
com.fuzz.android.limelight.recorder.widget.editor.operations.ChangeBackgroundColorOperation.java
com.fuzz.android.limelight.recorder.widget.editor.operations.ChangeIconOperation.java
com.fuzz.android.limelight.recorder.widget.editor.operations.SetTextColorOperation.java
com.fuzz.android.limelight.recorder.widget.filedialog.FileDirectoryDialog.java
com.fuzz.android.limelight.recorder.widget.filedialog.OnDirectorySelectListener.java
com.fuzz.android.limelight.recorder.widget.snap.SnapHelper.java
com.fuzz.android.limelight.recorder.widget.snap.SnapInfo.java
com.fuzz.android.limelight.text.PrimeTextWatcher.java
com.fuzz.android.limelight.util.FontUtils.java
com.fuzz.android.limelight.util.IOUtils.java
com.fuzz.android.limelight.util.JSONTool.java
com.fuzz.android.limelight.util.LimeLightLog.java
com.fuzz.android.limelight.util.ViewUtils.java
com.fuzz.android.limelight.view.PrimeClickListener.java
com.fuzz.android.limelight.widget.ManualPositionFrameLayout.java