@@ -0,0 +1,3231 @@
+/*%0A * Copyright (C) 2015 Suhan Lee%0A *%0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A *      http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0Apackage com.honeycomb.client.lib.bugreporter.util;%0A%0Aimport android.util.Log;%0A%0Aimport com.honeycomb.client.lib.BuildConfig;%0A%0Apublic class ALog %7B%0A%0A    private static String TAG = %22ALOG%22;%0A    private static int MAX_LENGTH = 2048;%0A    private static String PREFIX = %22%22;%0A%0A    private static String getPrefix(StackTraceElement callerElement) %7B%0A            return PREFIX + %22%5B%22 +%0A                    callerElement.getFileName().replace(%22.java%22, %22%22) + %22:%22 +%0A                    callerElement.getMethodName() + %22:%22 +%0A                    callerElement.getLineNumber() + %22%5D%22;%0A%0A    %7D%0A%0A    private static String replaceLineFeeds(String str) %7B%0A        if(str == null %7C%7C str.length() == 0) %7B%0A            return null;%0A        %7D%0A%0A        String clean = str.replace('%5Cn', '_').replace('%5Cr', '_');%0A%0A        if(str.equals(clean) == false) %7B%0A            clean += %22 (Modified)%22;%0A        %7D%0A        return clean;%0A    %7D%0A%0A    private static void print(LogFunction log, Object... obj) %7B%0A        // only debug mode.%0A        if (!BuildConfig.DEBUG) %7B%0A            return;%0A        %7D%0A%0A        Exception exception = new Exception();%0A        StackTraceElement callerElement = exception.getStackTrace()%5B1%5D;%0A        String strString = obj.length == 0 ? %22%22 : obj%5B0%5D.toString();%0A%0A        boolean isFirst = true;%0A%0A        String clean = replaceLineFeeds( strString );%0A%0A        while ( clean != null && clean.length() %3E 0 ) %7B%0A            String strCurrent = clean;%0A            if ( clean.length() %3E MAX_LENGTH) %7B%0A                strCurrent = clean.substring( 0, MAX_LENGTH);%0A            %7D%0A%0A            if (isFirst) %7B%0A                log.p(getPrefix(callerElement) + strCurrent);%0A            %7Delse%7B%0A                log.p(strCurrent);%0A            %7D%0A%0A            if (clean.length() %3E MAX_LENGTH) %7B%0A                clean = clean.substring(MAX_LENGTH, clean.length() );%0A            %7Delse%7B%0A                clean = null;%0A            %7D%0A            isFirst = false;%0A        %7D%0A    %7D%0A%0A    public static void i(Object... obj) %7B%0A        print(new LogFunction() %7B%0A            @Override%0A            public void p(String str) %7B%0A                Log.i(TAG, str);%0A            %7D%0A        %7D, obj);%0A    %7D%0A%0A    public static void w(Object... obj) %7B%0A        print(new LogFunction() %7B%0A            @Override%0A            public void p(String str) %7B%0A                Log.w(TAG, str);%0A            %7D%0A        %7D, obj);%0A    %7D%0A%0A    public static void e(Object... obj) %7B%0A        print(new LogFunction() %7B%0A            @Override%0A            public void p(String str) %7B%0A                Log.e(TAG, str);%0A            %7D%0A        %7D,  obj);%0A    %7D%0A%0A    private interface LogFunction %7B%0A        void p(String str);%0A    %7D%0A%7D%0A

add ALog to show logging effectily