Java Code Examples for android.util.Log#VERBOSE

The following examples show how to use android.util.Log#VERBOSE . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
@Override
protected void log(int priority, @Nullable String tag, @NotNull String message, @Nullable Throwable t) {
    // Workaround for devices that doesn't show lower priority logs
    if(Build.MANUFACTURER == null) {
        return;
    }
    if (Build.MANUFACTURER.equals("HUAWEI") || Build.MANUFACTURER.equals("samsung")) {
        if (priority == Log.VERBOSE || priority == Log.DEBUG || priority == Log.INFO)
            priority = Log.ERROR;
    }
    if (priority >= Log.WARN) {
        if(message.length() < MAX_LOG_LENGTH) {
            super.log(priority, tag, message, t);
            return;
        }
        splitLogMessage(priority, tag, message, t);
    } else {
        if(message.length() < MAX_LOG_LENGTH) {
            super.log(priority, tag, message, t);
            return;
        }
        splitLogMessage(priority, tag, message, t);
    }
}
 
Example 2
Source Project: RxShell   File: JUnitTree.java    License: Apache License 2.0 6 votes vote down vote up
private static String priorityToString(int priority) {
    switch (priority) {
        case Log.ERROR:
            return "E";
        case Log.WARN:
            return "W";
        case Log.INFO:
            return "I";
        case Log.DEBUG:
            return "D";
        case Log.VERBOSE:
            return "V";
        default:
            return String.valueOf(priority);
    }
}
 
Example 3
@Override
public void log(int priority, @NonNull String message) {
    if (mLoggingEnabled) {
        switch (priority) {
            case Log.DEBUG:
                LOG.debug(message);
                break;
            case Log.INFO:
                LOG.info(message);
                break;
            case Log.WARN:
                LOG.warn(message);
                break;
            case Log.ERROR:
            case Log.ASSERT:
                LOG.error(message);
                break;
            case Log.VERBOSE:
            default:
                LOG.trace(message);
                break;
        }
    }
}
 
Example 4
void bind(LogcatDumper.LogInfo log) {
    mCurLog = log;
    switch (log.level) {
        case Log.VERBOSE:
            mText.setTextColor(Color.parseColor("#FFFFFF"));
            break;
        case Log.INFO:
            mText.setTextColor(Color.parseColor("#2196F3"));

            break;
        case Log.DEBUG:
            mText.setTextColor(Color.parseColor("#4CAF50"));

            break;
        case Log.WARN:
            mText.setTextColor(Color.parseColor("#FFEB3B"));
            break;
        case Log.ERROR:
            mText.setTextColor(Color.parseColor("#F44336"));
            break;
        default:
            mText.setTextColor(Color.parseColor("#FFFFFF"));

    }
    mText.setText(log.message);
}
 
Example 5
Source Project: DoraemonKit   File: LogInfoDokitView.java    License: Apache License 2.0 6 votes vote down vote up
private int getSelectLogLevel() {
    int checkedId = mRadioGroup.getCheckedRadioButtonId();
    if (checkedId == R.id.verbose) {
        return Log.VERBOSE;
    } else if (checkedId == R.id.debug) {
        return Log.DEBUG;
    } else if (checkedId == R.id.info) {
        return Log.INFO;
    } else if (checkedId == R.id.warn) {
        return Log.WARN;
    } else if (checkedId == R.id.error) {
        return Log.ERROR;
    } else {
        return Log.VERBOSE;
    }
}
 
Example 6
Source Project: RxShell   File: JUnitTree.java    License: Apache License 2.0 6 votes vote down vote up
private static String priorityToString(int priority) {
    switch (priority) {
        case Log.ERROR:
            return "E";
        case Log.WARN:
            return "W";
        case Log.INFO:
            return "I";
        case Log.DEBUG:
            return "D";
        case Log.VERBOSE:
            return "V";
        default:
            return String.valueOf(priority);
    }
}
 
Example 7
private static String logTypeToString(int type) {
    switch (type) {
        case Log.ASSERT:
            return "Assert";
        case Log.DEBUG:
            return "Debug";
        case Log.ERROR:
            return "Error";
        case Log.WARN:
            return "Warn";
        case Log.INFO:
            return "Info";
        case Log.VERBOSE:
            return "Verbose";
        default:
            return "?";
    }
}
 
Example 8
Source Project: javaide   File: LogLine.java    License: GNU General Public License v3.0 6 votes vote down vote up
private static int convertCharToLogLevel(char logLevelChar) {

        switch (logLevelChar) {
            case 'D':
                return Log.DEBUG;
            case 'E':
                return Log.ERROR;
            case 'I':
                return Log.INFO;
            case 'V':
                return Log.VERBOSE;
            case 'W':
                return Log.WARN;
            case 'F':
                return LogLineAdapterUtil.LOG_WTF; // 'F' actually stands for 'WTF', which is a real Android log level in 2.2
        }
        return -1;
    }
 
Example 9
@Override
protected void log(int priority, @Nullable String tag, @Nullable String message, @Nullable Throwable t) {
    if (priority == Log.VERBOSE || priority == Log.DEBUG || priority == Log.INFO) {
        return;
    }

    Crashlytics.setInt(CRASHLYTICS_KEY_PRIORITY, priority);
    Crashlytics.setString(CRASHLYTICS_KEY_TAG, tag);
    Crashlytics.setString(CRASHLYTICS_KEY_MESSAGE, message);

    if (t == null) {
        Crashlytics.logException(new Exception(message));
    } else {
        Crashlytics.logException(t);
    }
}
 
Example 10
Source Project: AndroidBlueprints   File: MyApplication.java    License: Apache License 2.0 6 votes vote down vote up
@Override
protected void log(int priority, String tag, String message, Throwable throwable) {
    if (priority == Log.VERBOSE || priority == Log.DEBUG) {
        return;
    }

    FakeCrashLibrary.log(priority, tag, message);

    if (throwable != null) {
        if (priority == Log.ERROR) {
            FakeCrashLibrary.logError(throwable);
        } else if (priority == Log.WARN) {
            FakeCrashLibrary.logWarning(throwable);
        }
    }
}
 
Example 11
private int getLevel(@NonNull String log) {
    if(log.length() < 20){
        return 'V';
    }
    char level = log.charAt(19);
    switch (level) {
        case 'V':
            return Log.VERBOSE;
        case 'I':
            return Log.INFO;
        case 'D':
            return Log.DEBUG;
        case 'W':
            return Log.WARN;
        case 'E':
            return Log.ERROR;
    }
    return 0;
}
 
Example 12
Source Project: MediaSDK   File: AsyncHttpRequest.java    License: Apache License 2.0 5 votes vote down vote up
public void logv(String message) {
    if (LOGTAG == null)
        return;
    if (logLevel > Log.VERBOSE)
        return;
    Log.v(LOGTAG, getLogMessage(message));
}
 
Example 13
Source Project: Learning-Resources   File: ReleaseTimberTree.java    License: MIT License 5 votes vote down vote up
@Override
protected boolean isLoggable(String tag, int priority) {
    if (priority == Log.VERBOSE || priority == Log.DEBUG || priority == Log.INFO) {
        return false;
    }

    // In Case of Release Build User can only get Log for : Log.WARN, Log.ERROR, wtf

    return true;
}
 
Example 14
Source Project: timecat   File: LogUtil.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * 用于区分不同接口数据 打印传入参数
 *
 * @param index
 * @param str
 */

private static void print(int index, Object str) {
    if (!OPEN_LOG) {
        return;
    }
    if (log == null) {
        log = new LogUtil(USER_NAME);
    }
    String name = log.getFunctionName();
    if (name != null) {
        str = String.format("%s -----> %s", name, str);
    }

    // Close the debug log When DEBUG is false
    if (!DEBUG) {
        if (index <= Log.DEBUG) {
            return;
        }
    }
    switch (index) {
        case Log.VERBOSE:
            Log.v(tag, str.toString());
            break;
        case Log.DEBUG:
            Log.d(tag, str.toString());
            break;
        case Log.INFO:
            Log.i(tag, str.toString());
            break;
        case Log.WARN:
            Log.w(tag, str.toString());
            break;
        case Log.ERROR:
            Log.e(tag, str.toString());
            break;
        default:
            break;
    }
}
 
Example 15
Source Project: okuki   File: App.java    License: Apache License 2.0 5 votes vote down vote up
@Override
protected void log(int priority, String tag, String message, Throwable t) {
    if (priority == Log.VERBOSE || priority == Log.DEBUG) {
        return;
    }

    //TODO Log to crash reporting
    if (t != null) {
        if (priority == Log.ERROR) {
            //TODO Log throwable as error to crash reporting
        } else if (priority == Log.WARN) {
            //TODO Log throwable as warning to crash reporting
        }
    }
}
 
Example 16
Source Project: StatusStories   File: LoggingListener.java    License: Apache License 2.0 4 votes vote down vote up
public LoggingListener(@NonNull String name) {
    this(Log.VERBOSE, name);
}
 
Example 17
Source Project: materialup   File: L.java    License: Apache License 2.0 4 votes vote down vote up
private static void log(final int pType, final Throwable t, final Object s1,
                        final Object... args) {
    if (pType == Log.ERROR || BuildConfig.DEBUG || Log.isLoggable("L", pType)) {
        final StackTraceElement stackTraceElement = Thread.currentThread().getStackTrace()[4];

        final String fullClassName = stackTraceElement.getClassName();
        final String className = fullClassName.substring(fullClassName.lastIndexOf(".") + 1);
        final int lineNumber = stackTraceElement.getLineNumber();
        final String method = stackTraceElement.getMethodName();

        final String tag = className + ":" + lineNumber;

        final StringBuilder stringBuilder = new StringBuilder();
        stringBuilder.append(method);
        stringBuilder.append("(): ");

        if (s1 != null) {
            final String message = (args == null) ? s1.toString()
                    : String.format((String) s1, args);
            stringBuilder.append(message);
        }

        switch (pType) {
            case Log.VERBOSE:
                if (t != null) {
                    Log.v(tag, stringBuilder.toString(), t);
                } else {
                    Log.v(tag, stringBuilder.toString());
                }
                break;

            case Log.DEBUG:
                if (t != null) {
                    Log.d(tag, stringBuilder.toString(), t);
                } else {
                    Log.d(tag, stringBuilder.toString());
                }
                break;

            case Log.INFO:
                if (t != null) {
                    Log.i(tag, stringBuilder.toString(), t);
                } else {
                    Log.i(tag, stringBuilder.toString());
                }
                break;

            case Log.WARN:
                if (t != null) {
                    Log.w(tag, stringBuilder.toString(), t);
                } else {
                    Log.w(tag, stringBuilder.toString());
                }
                break;

            case Log.ERROR:
                if (t != null) {
                    Log.e(tag, stringBuilder.toString(), t);
                } else {
                    Log.e(tag, stringBuilder.toString());
                }
                break;
        }
    }
}
 
Example 18
Source Project: NewbieGuide   File: LogUtil.java    License: Apache License 2.0 4 votes vote down vote up
public static void v(String msg, Throwable tr) {
    if (level <= Log.VERBOSE) {
        String tag = generateTag();
        Log.v(tag, msg, tr);
    }
}
 
Example 19
Source Project: Phantom   File: VLog.java    License: Apache License 2.0 4 votes vote down vote up
public static void v(String format, Object... args) {
    if (Log.VERBOSE >= sLevel) {
        Log.v(sTag, buildMsg(String.format(format, args)));
    }
}
 
Example 20
Source Project: droidddle   File: L.java    License: Apache License 2.0 4 votes vote down vote up
private static void log(final int pType, final Throwable t, final Object s1, final Object... args) {
    if (pType == Log.ERROR || BuildConfig.DEBUG) {
        final StackTraceElement stackTraceElement = Thread.currentThread().getStackTrace()[4];

        final String fullClassName = stackTraceElement.getClassName();
        final String className = fullClassName.substring(fullClassName.lastIndexOf(".") + 1);
        final int lineNumber = stackTraceElement.getLineNumber();
        final String method = stackTraceElement.getMethodName();

        final String tag = className + ":" + lineNumber;

        final StringBuilder stringBuilder = new StringBuilder();
        stringBuilder.append(method);
        stringBuilder.append("(): ");

        if (s1 != null) {
            final String message = (args == null) ? s1.toString() : String.format((String) s1, args);
            stringBuilder.append(message);
        }

        switch (pType) {
            case Log.VERBOSE:
                if (t != null) {
                    Log.v(tag, stringBuilder.toString(), t);
                } else {
                    Log.v(tag, stringBuilder.toString());
                }
                break;

            case Log.DEBUG:
                if (t != null) {
                    Log.d(tag, stringBuilder.toString(), t);
                } else {
                    Log.d(tag, stringBuilder.toString());
                }
                break;

            case Log.INFO:
                if (t != null) {
                    Log.i(tag, stringBuilder.toString(), t);
                } else {
                    Log.i(tag, stringBuilder.toString());
                }
                break;

            case Log.WARN:
                if (t != null) {
                    Log.w(tag, stringBuilder.toString(), t);
                } else {
                    Log.w(tag, stringBuilder.toString());
                }
                break;

            case Log.ERROR:
                if (t != null) {
                    Log.e(tag, stringBuilder.toString(), t);
                } else {
                    Log.e(tag, stringBuilder.toString());
                }
                break;
        }
    }
}